C PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP
C PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#include<stdio.h> void main() { float value1,value2; char operator; printf("\n >>> PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP <<< \n"); printf("\n Enter Your Expression : "); scanf("%f %c %f",&value1,&operator,&value2); switch(operator) { case '+' : printf("\n Addition Result is : %f \n",value1+value2); break; case '-' : printf("\n Subtraction Result is : %f \n",value1-value2); break; case '*' : printf("\n Multiplication Result is : %f \n",value1*value2); break; case '/' : printf("\n Division Result is : %f \n",value1/value2); break; default : printf("\n Unknown operator"); break; } getch(); } |