Learn about **C Program to Compute Addition Subtraction and Multiplication** in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Contents

#### C Program to Compute Addition Subtraction and Multiplication

The code will ask the user to enter two number digits, and the user will select an operator to execute the addition, subtraction, multiplication, and division of the entered number, and the program will display the result based on the user’s option.

**Source code:**

```
#include<stdio.h>
int main()
{
// declare variables
int num1, num2, sum, subtract, multiple;
// inputs from user
printf("Enter two integers: ");
scanf("%d %d", &num1, &num2);
// calculating addition
sum = num1 + num2;
// calculating subtraction
subtract = num1 - num2;
// calculating multiplocation
multiple = num1 * num2;
// print results
printf("%d + %d = %d\n", num1, num2, sum);
printf("%d - %d = %d\n", num1, num2, subtract);
printf("%d * %d = %d\n", num1, num2, multiple);
return 0;
}
```

**Output:**

Enter two integers: 5 10

5 + 10 = 15

5 – 10 = -5

5 * 10 = 50

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

**Similar Codes :**

Finding out the Age in Terms of Years, Months and Days in C

Simple C Program to Find the Total Cost of the Vehicle