#include <stdio.h>
#include <conio.h>
int main()
{
char i;
int a,b;
printf("enter two numbers\n");
scanf("%d%d",&a,&b);
printf("enter arithmetic operator '+' or '-' or '/' or'*'\n");
i=getche();
printf("\b");
if(i=='+')
printf("%d + %d = %d",a,b,a+b);
else if(i=='-')
printf("%d - %d = %d",a,b,a-b);
else if(i=='*')
printf("%d * %d = %d",a,b,a*b);
else if(i=='/')
printf("%d / %d = %f",a,b,(float)a/b);
else
printf("wrong arithmetic operator selected");
return 0;
}
No comments:
Post a Comment