# C arithmetic operator

Table of content

## Arithmetic Operator in C Programming Language

- C Programming Supports
**5 Arithmetic Operators**. - Arithmetic Operators are used for “
**Arithmetic Calculation**“.

## Supported Arithmetic Operators :

5 arithmetic operators are shown in the following table. Arithmetic operators are used to perform arithmetic operations in c programming.

Operator | Meaning | Example |
---|---|---|

+ | Addition Operator | 10 + 20 = 30 |

- | Subtraction Operator | 20 – 10 = 10 |

* | Multiplication Operator | 20 * 10 = 200 |

/ | Division Operator | 20 / 10 = 2 |

% | Modulo Operator | 20 % 6 = 2 |

## Live Example : C Program to Verify Arithmetic Operator and Operation

#include <stdio.h> int main() { int num1,num2; int sum,sub,mult,div,mod; printf("\nEnter First Number :"); scanf("%d",&num1); printf("\nEnter Second Number :"); scanf("%d",&num2); sum = num1 + num2; printf("\nAddition is : %d",sum); sub = num1 - num2; printf("\nSubtraction is : %d",sub); mult = num1 * num2; printf("\nMultiplication is : %d",mult); div = num1 / num2; printf("\nDivision is : %d",div); mod = num1 % num2; printf("\nModulus is : %d",mod); return(0); }

## Output :

Enter First Number : 10 Enter Second Number : 5 Addition is : 15 Subtraction is : 5 Multiplication is : 50 Division is : 2 Modulus is : 0

## Precedence Power : Which Operator have Highest Priority ?

If we consider all the arithmetic operators then we can say that Multiplication and division operator have highest priority than addition and subtraction operator. Following table clearly explains the priority of all arithmetic operators in C programming –

Priority Rank | Operator Description | Operator | Associativity |
---|---|---|---|

1 | Multiplication | * | Left to Right |

1 | Division | / | Left to Right |

1 | Modulo | % | Left to Right |

2 | Addition | + | Left to Right |

2 | Subtraction | - | Left to Right |

## Note :

Whenever two or more operators comes in an expression with same priority rank then priority is decided by considering

**Operator Associativity**