write a program to create a calculator using switch case.
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b;
char operator;
printf("enter operator(+,-,*,/):");
scanf("%c",&operator);
printf("enter two number");
scanf("%d%d",&a,&b);
switch(operator)
{
case '+':
printf("%d",a+b);
break;
case '-':
printf("%d",a-b);
break;
case '*':
printf("%d",a*b);
break;
case '/':
printf("%d",a/b);
break;
default:
printf("error danger⚠️⚠️⚠️ ðŸ˜ðŸ˜");
break;
}
return 0;
}
Comments
Post a Comment