Question: Write a program that asks the user to enter two numbers, obtains them from the user and prints their sum, product, difference, quotient and remainder.
/*
* Author: AGHATISE OSAZUWA
* Website: www.cscprogrammingtutorials.com
*
* Program to calculate the sum, product, difference, quotient and remainder
* of two numbers entered by the user.
*/
#include <stdio.h>
int main (){
int num1, num2, sum, prod, diff, quot, rem;
puts("Enter two numbers: ");
scanf("%d%d", &num1, &num2);
sum = num1 + num2;
prod = num1 * num2;
diff = num1  num2;
quot = num1 / num2;
rem = num1%num2;
printf("The sum of %d and %d is %d.\n", num1, num2, sum);
printf("The product of %d and %d is %d.\n", num1, num2, prod);
printf("The difference of %d and %d is %d.\n", num1, num2, diff);
printf("The quotient of %d and %d is %d.\n", num1, num2, quot);
printf("The remainder of %d and %d is %d.\n", num1, num2, rem);
return 0;
}

Program output 
Click here to see other solutions to Deitel C How To Program exercises.
where is the quotient line?
ReplyDeleteThanks for pointing that out. I've added it.
Delete