#include <stdio.h>
int main(void)
{
int a, b;
char ch;
printf("Choice:\n");
printf("Add, Subtract, Multiply, or Divide?\n");
printf("Enter first letter: ");
ch = getchar();
printf("\n");
printf("Enter a: ");
scanf("%d", &a);
printf("Enter b: ");
scanf("%d", &b);
if(ch=='A') printf("%d", a+b);
if(ch=='S') printf("%d", a-b);
if(ch=='M') printf("%d", a*b);
if(ch=='D' && b!=0) printf("%d", a/b);
return 0;
}
|