C program for entering numbers and operators to calculate their output.
#include<stdio.h>
int main()
{
float a,b,c;
char f;
printf("enter any no\n");
scanf("%f",&a);
printf("enter the operation + * - /");
scanf(" %c",&f);
printf("\nenter the second number\n");
scanf(" %f",&b);
switch (f)
{
case '+':
c=a+b;
break;
case '*':
c=a-b;
break;
case '-':
c=a-b;
break;
case '/':
c=a/b;
break;
default:
printf("you have entered operations other than + - * /");
break;
}
printf("answer is %f",c);
return 0;
}
This is a program for making a calculator.