#include< stdio.h >
#include< conio.h >
void main()
{
char op;
int a,b;
float ans;
clrscr();
printf("first is :");
scanf("%d",&a);
printf("second is :");
scanf("%d",&b);
fflush(stdin);
printf("oprater:",op );
scanf("%c",&op);
if (op=='+')
{
ans=a+b;
printf("Answer=%f",ans);
}
else if (op=='-')
{
ans=a-b;
printf("Answer=%f",ans);
}
else if (op=='*')
{
ans=a*b;
printf("Answer=%f",ans);
}
else if (op=='%')
{
ans=a%b;
printf("Answer=%f",ans);
}
else if (op=='/')
{
if (a==0||b==0)
{
printf("Check your entry\n Mathematics Error");
}
else
{
ans=a/b;
printf("Answer=%f",ans);
}
}
getch();
}
Output:-
First is:(enter value)
Second is: (enter value)
Operator: (enter value)
Answer: