# Arithmetic Operations in C programming

**Program description:**

Write a program to **perform arithmetic operations in c programming** language.

The program will take two integers as the input from the user. And then we will perform the addition, subtraction, multiplication, division, and modulus of the two integers.

**Example: Arithmetic Operations:**

**Input:**

1 |
Enter two integers : 20 10 |

**Output:**

1 2 3 4 5 |
Addition of 20 and 10 is : 30 Subtraction of 20 and 10 is : 10 Product of 20 and 10 is : 200 Division of 20 and 10 is : 2 Modulus of 20 and 10 is : 0 |

**Program : Arithmetic Operations in C:**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include<stdio.h> int main(void) { Â Â Â Â int a,b; Â Â Â Â Â // Take input from the user. Â Â Â Â printf("Enter two integers : "); Â Â Â Â scanf("%d%d",&a, &b); Â Â Â Â Â // Perform all arithmetic operations. Â Â Â Â printf("Addition of %d and %d is : %d\n", a, b, a+b);Â Â Â Â Â Â Â Â printf("Subtraction of %d and %d is : %d\n", a, b, a-b); Â Â Â Â printf("Product of %d and %d is : %d\n", a, b, a*b); Â Â Â Â printf("Division of %d and %d is : %d\n", a, b, a/b); Â Â Â Â printf("Modulus of %d and %d is : %d\n", a, b, a%b); Â Â Â Â return 0; } |

Above program will take two integers from user and then uses the in-built addition operator ( â€˜+â€™ ) to perform the sum of two integer.

Similarly we use subtraction operator ( â€˜-â€˜ ), Multiplication operator ( â€˜*â€™ ), Division Operator ( â€˜/â€™ ) and Modulus Operators ( â€˜%â€™ ) to perform remaining arithmetic operations.

We have discussed more about the arithmetic operators in the following article. Please go through it for more info

Arithmetic Operators in C Language | Examples of Arithmetic Operators â€“ SillyCodes

**Output:**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
// Compile the program $ gcc arithmeticOperations.c Â // Executable file is generated. Name of executable file is './a.out' $ ./a.out Enter two integers : 10 2 Addition of 10 and 2 is : 12 Subtraction of 10 and 2 is : 8 Product of 10 and 2 is : 20 Division of 10 and 2 is : 5 Modulus of 10 and 2 is : 0 $ Â // Example 2 $ ./a.out Enter two integers : 50 10 Addition of 50 and 10 is : 60 Subtraction of 50 and 10 is : 40 Product of 50 and 10 is : 500 Division of 50 and 10 is : 5 Modulus of 50 and 10 is : 0 $ Â // Example 3 $ ./a.out Enter two integers : 6 4 Addition of 6 and 4 is : 10 Subtraction of 6 and 4 is : 2 Product of 6 and 4 is : 24 Division of 6 and 4 is : 1 Modulus of 6 and 4 is : 2 |

**Conclusion:**

In this article, We have discussed about the arithmetic operators and how to perform arithmetic operations in the c programming language.

## 4 Responses

[â€¦] Arithmetic Operations in C programming â€“ SillyCodes [â€¦]

[â€¦] C Program to perform all Arithmetic Operations [â€¦]

[â€¦] C Program to perform all Arithmetic Operations [â€¦]

[â€¦] The goal of the program is to familiarize ourselves with the functions. As we have written the arithmetic operations programs earlier without using [â€¦]