Answers for "C program to print calculator using switch statement"

C
0

C program to print calculator using switch statement

#include<stdio.h> 
int main()
{ 
int a, b, total;
char op; 
printf("Enter the number");
scanf("%d%c%d", &a, &op, &b);
switch(op)
{
case '+':
total = a + b;
break;
case '-':
total = a - b;
break;
case '*':
total = a * b;
break;
case '/':
total = a / b;
break; 
}
printf("total = %d", total);
return 0; 
}
Posted by: Guest on June-14-2021

Code answers related to "C program to print calculator using switch statement"

Code answers related to "C"

Browse Popular Code Answers by Language