C arithmetic operator

Arithmetic Operator in C Programming Language

  1. C Programming Supports 5 Arithmetic Operators.
  2. 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.

OperatorMeaningExample
+Addition Operator10 + 20 = 30
-Subtraction Operator20 – 10 = 10
*Multiplication Operator20 * 10 = 200
/Division Operator20 / 10 = 2
%Modulo Operator20 % 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 RankOperator DescriptionOperatorAssociativity
1Multiplication*Left to Right
1Division/Left to Right
1Modulo%Left to Right
2Addition+Left to Right
2Subtraction-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