@@ -3,22 +3,16 @@ the user and prints their sum, product, difference, quotient and remainder. */
3
3
#include <stdio.h>
4
4
5
5
/* function main starts program execution */
6
- int main (void )
7
- {
8
- int num1 , num2 ; // variables to store the 2 number for the arithmetic
9
-
10
- printf ("Enter a value for the two numbers: \n" ); // prompt
11
- scanf ("%d%d" , & num1 , & num2 ); // read the two values into num1 and num2 respectively
12
-
13
- printf ("The Sum of %d and %d is %d\n" , num1 , num2 , num1 + num2 ); // prints their sum
14
-
15
- printf ("The Product of %d and %d is %d\n" , num1 , num2 , num1 * num2 ); // prints their product
16
-
17
- printf ("The Difference of %d and %d is %d\n" , num1 , num2 , num1 - num2 ); // prints their difference
18
-
19
- printf ("The Quotient of %d and %d is %d\n" , num1 , num2 , num1 / num2 ); // prints their quotient
6
+ int main (void ) {
7
+ int num1 , num2 ; // variables to store the 2 number for the arithmetic
20
8
21
- printf ("The Remainder of %d and %d is %d\n" , num1 , num2 , num1 % num2 ); // prints their remainder
9
+ printf ("Enter two numbers: " ); // prompt
10
+ scanf ("%d%d" , & num1 , & num2 ); // read the two values into num1 and num2 respectively
22
11
23
-
24
- }
12
+ printf ("Sum: %d\n" , num1 + num2 );
13
+ printf ("Product: %d\n" , num1 * num2 ); // prints their sum
14
+ printf ("Difference: %d\n" , num1 - num2 ); // prints their product
15
+ printf ("Quotient: %d\n" , num1 / num2 ); // prints their quotient
16
+ printf ("Remainder: %d\n" , num1 % num2 ); // prints their remainder
17
+ return 0 ;
18
+ }
0 commit comments