Source code:
#include <stdio.h>
int main()
{
printf("calculator\n");
float a, b;
char c;
printf("Do the operetion\n");
scanf("%f", &a);
scanf("%c", &c);
scanf("%f", &b);
switch (c)
{
case '+':
printf("=%f", a + b);
break;
case '-':
printf("=%f", a - b);
break;
case '*':
printf("=%f", a * b);
break;
case '/':
printf("=%f", a / b);
break;
default:
printf("error");
break;
}
return 0;
}
0 Comments