long int addition(long int, long int); long int subtraction(long int, long int); long int multiplication(long int, long int); long int division(long int, long int);
int main(void) { char c; long int first; long int second; long int answer;
while (1){
printf("Please choose your operation: \n");
printf("a. Addition s. Subtraction\n");
printf("m. Multiplication d. Division\n");
printf("q. Quit\n");
(c = getchar()) != 'q')
{
switch (c)
{
case 'a':
printf("Please enter two integers: \n");
scanf("%ld %ld", &first, &second);
answer = addition(first, second);
printf("The sum of %ld and %ld is %ld\n", first, second, answer);
break;
case 's':
printf("Please enter two integers: \n");
scanf("%ld %ld", &first, &second);
answer = subtraction(first, second);
printf("The difference between %ld and %ld is %ld\n", first, second, answer);
break;
case 'm':
printf("Please enter two integers: \n");
scanf("%ld %ld", &first, &second);
answer = multiplication(first, second);
printf("The product of %ld and %ld is %ld\n", first, second, answer);
break;
case 'd':
printf("Please enter two integers: \n");
scanf("%ld %ld", &first, &second);
answer = division(first, second);
printf("The quotient of %ld and %ld is %ld\n", first, second, answer);
break;
}
printf("Buh Bye!");
}
}
return 0;
}
long int addition(long int a, long int b) { long int sum = a + b; return sum; }
long int subtraction(long int a, long int b) { long int difference = a - b;
return difference;
}
long int multiplication(long int a, long int b) { long int product = a * b;
return product;
}
long int division(long int a, long int b) { long int quotient = a / b;
return quotient;
}