Skip to content

Commit 2081ef5

Browse files
authored
Merge pull request #2 from imkashyap888/patch-1
Update arithmetic.c
2 parents 0cc9642 + 290debf commit 2081ef5

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

00_operators/arithmetic.c

+11-17
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,16 @@ the user and prints their sum, product, difference, quotient and remainder. */
33
#include <stdio.h>
44

55
/* 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
208

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
2211

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

Comments
 (0)