2.2.5 Arithmetic Operations on Integers

Let’s play with some of these integer numbers using arithmetic operations.

 #include <stdio.h>
 
int main() {
 int a = 5;
 int b = 3;
 int sum = a + b;
 int difference = a- b;
 int product = a * b;
 int quotient = a / b;
 int remainder = a % b;

 printf("Sum: %d\n", sum);
 printf("Difference: %d\n", difference);
 printf("Product: %d\n", product);
 printf("Quotient: %d\n", quotient);
 printf("Remainder: %d\n", remainder);
 return 0;
 }

After compiling the code and executing the object file,you should get the following results:

 Sum: 8
 Difference: 2
 Product: 15
 Quotient: 1
 Remainder: 2