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.
		
		
			
			
			
			
				
					
			
		
				
		| 1 2 | /* <br /> * Author: AGHATISE OSAZUWA<br /> * Website: www.cscprogrammingtutorials.com <br /> *<br /> * Program to calculate the sum, product, difference, quotient and remainder<br /> * of two numbers entered by the user.<br /> */<br /><br />#include <stdio.h><br />int main (){<br />    int num1, num2, sum, prod, diff, quot, rem;<br />    puts("Enter two numbers: ");<br />    scanf("%d%d", &num1, &num2);<br />    sum = num1 + num2;<br />    prod = num1 * num2;<br />    diff = num1 - num2;<br />    quot = num1 / num2;<br />    rem = num1%num2;<br />    printf("The sum of %d and %d is %d.n", num1, num2, sum);<br />    printf("The product of %d and %d is %d.n", num1, num2, prod);<br />    printf("The difference of %d and %d is %d.n", num1, num2, diff);<br />    printf("The quotient of %d and %d is %d.n", num1, num2, quot);<br />    printf("The remainder of %d and %d is %d.n", num1, num2, rem);<br />    return 0;<br />}<br /> | 
|  | 
| Program output | 
Click here to see other solutions to Deitel C How To Program exercises.
 
				
		
2 Comments
Thanks for pointing that out. I've added it.
where is the quotient line?