## Introduction to Arithmetic Operators in C

Arithmetic operators are used for performing mathematical operations. C supports these operators to perform various mathematical operations such as addition, subtraction, division, multiplication, etc.

There are various operators in C which are as follows:

**Addition Operator +**: This operator is used to add two operands. Suppose P and Q are two operands, this plus operators will add up these two operands. i.e. P + Q.**Subtraction Operator –**: This operator is used to subtract two operands. Suppose P and Q are two operands, then this minus operator will subtract the value of the second operand from the first operand. i.e. P – Q.**Multiplication Operator ***: This operator is used to multiply two operands. Suppose P and Q are two operands then this multiplication operator will multiply P with Q. i.e. P * Q.**Division Operator /**: This operator is used to numerator by the denominator. Suppose P and Q are two operands, this division operator divides the numerator by denominator. i.e. P / Q.**Modulus Operator %**: This operator is used to give the remainder of the division. Suppose P and Q are two operands then this modulus operator first divides the numerator by denominator and gives the remainder. i.e. P % Q.**Increment Operator ++**: This operator is used to increment the value of the variable by 1. Suppose X is the operand, then this increment operator will add the value of P by 1.**Decrement Operator — :**This operator is used to decrement the value of the variable by 1. Suppose X is the operand, this decrement operator will decrement the value of P by 1.

### Examples of Arithmetic Operators in C

The following tutorial is a guide to the examples of arithmetic operators.

#### Example #1

Program to use Addition (+) operator in C.

`#include<stdio.h>`

#include<conio.h>

int main()

{

int P, Q, total;

printf(" Enter the value of P: ");

scanf("%d" ,&P);

printf(" Enter the value of Q: ");

scanf("%d",&Q);

total = P + Q;

printf("%d", total);

return 0;

}

**Output:**

#### Example #2

Program to use Subtraction (-) operator in C.

`#include<stdio.h>`

#include<conio.h>

int main()

{

int P, Q, total;

printf(" Enter the value of P: ");

scanf("%d" , &P);

printf(" Enter the value of Q: ");

scanf("%d", &Q);

total = P - Q;

printf("%d", total);

return 0;

}

**Output:**

#### Example #3

Program to use multiplication * arithmetic operator in C.

`#include<stdio.h>`

#include<conio.h>

int main()

{

int P, Q, total;

printf(" Enter the value of P: ");

scanf("%d", &P);

printf(" Enter the value of Q: ");

scanf("%d", &Q);

total = P * Q;

printf("%d", total);

return 0;

4.5 (3,584 ratings)

View Course

**Output:**

#### Example #4

Program to use Division/Arithmetic operator in C

`#include<stdio.h>`

#include<conio.h>

int main()

{

int P, Q, total;

printf(" Enter the value of P: ");

scanf("%d", &P);

printf(" Enter the value of Q: ");

scanf("%d", &Q);

total = P / Q;

printf("%d", total);

return 0;

}

**Output:**

#### Example #5

Program to use modulus % arithmetic operator in C.

`#include<stdio.h>`

#include<conio.h>

int main()

{

int P, Q, total;

printf(" Enter the value of P: ");

scanf("%d", &P);

printf(" Enter the value of Q: ");

scanf("%d", &Q);

total = P % Q;

printf("%d", total);

return 0;

}

**Output:**

#### Example #6

Program to use Increment ++ arithmetic operator in C.

`#include<stdio.h>`

#include<conio.h>

int main()

{

int P;

printf("Enter the value of P: ");

scanf("%d",&P);

P++;

printf("%d",P);

return 0;

}

**Output:**

#### Example #7

Program to use Decrement — arithmetic operator in C.

`#include<stdio.h>`

#include<conio.h>

int main()

{

int P;

printf("Enter the value of P: ");

scanf("%d",&P);

P--;

printf("%d",P);

return 0;

}

**Output:**

### Recommended Articles

This is a guide to Arithmetic Operators in C. Here we discuss the Introduction, different types of arithmetic operators and examples. You may also have a look at the following articles to learn more –

- TypeScript Operators | Classification of Operators
- PostgreSQL Operators | Examples and Types
- Different Types of Scala Operators
- PostgreSQL Operators | Open Source Software
- Complete Guide to MINUS in Oracle
- Guide to 7 Arithmetic Operators in Python
- List of Various Arithmetic Operators in Java
- Arithmetic Operators in JavaScript
- Guide to Arithmetic Operators in PHP