• Follow Us

Calculator Using Switch in C: Project in C Programming Language

#include<stdio.h>
int main()
{
int a,b;
char c;
scanf("%d %c %d",&a,&c,&b);

switch(c)
{
case '+':
printf("The sum is %d",a+b);
break;
case '-':
printf("The difference is %d",a-b);
break;
case '*':
printf("The product is %d",a*b);
break;
case '/':
printf("The quotient is %d",a/b);
break;
case '%':
printf("The remainder is %d",a%b);
break;
default:
printf("Invalid Input");
}
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Shopping cart