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

Popular posts from this blog

write a program for insertion sort with example.