# Explain the concept of Arithmetic operators in C language

CServer Side ProgrammingProgramming

#### C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Master C and Embedded C Programming- Learn as you go

66 Lectures 5.5 hours

It is used to perform the arithmetic operations like addition, subtraction etc.

Operator
Description
Example
a=20,b=10
Output
+
a+b
20+10
30
-
subtraction
a-b
20-10
10
*
multiplication
a*b
20*10
200
/
Division
a/b
20/10
2(quotient)
%
Modular Division
a%b
20%10
0 (remainder)

## Algorithm

Follow the algorithm mentioned below −

START
Step 1: Declare integer variables.
Step 2: Read all variables at runtime.
Step 3: Perform arithmetic operations.
i. a+b
ii. a-b
iii. a*b
iv. b/a
v. a%b
Step 4: Print all computed values.

## Program

Following is the C program to compute arithmetic operators −

#include<stdio.h>
main (){
int a,b;
printf("enter a,b:\n");
scanf("%d%d",&a,&b);
printf("a+b=%d\n",a+b);
printf("a-b=%d\n",a-b);
printf("a*b=%d\n",a*b);
printf("b/a=%d\n",b/a);
printf("a%b=%d\n",a%b);
}

## Output

You will see the following output −

enter a,b:
40 60
a+b=100
a-b=-20
a*b=2400
b/a=1
ab=40