Arithmetic Operators in C | ninjasquad

In this example, You learn about arithmetic operators in C. Also, Understand the math operators and operands. I’ll share the basic arithmetic operations program in which we do calculations on two operands.

Let’s understand the terms operators and operands.

Operator – This specifies the operation on data that contains some value.

Operand – The data on which operator works is called operand.

__Types of Arithmetic Operators in C__

__Types of Arithmetic Operators in C__

- Addition
- Subtraction
- Multiplication
- Division
- Modulus

You have doubt in the above paragraph then I shared a table below which clear your all doubts and it helps to understand about operators.

Arithmetic Operators |
Operation |
Example |

+ | Addition | 15 + 3 = 18 |

– | Subtraction | 15 – 3 = 12 |

* | Multiplication | 15 * 3 = 45 |

/ | Divison | 15 / 3 = 5 |

% | Modulus | 15 % 3 = 0 |

Some of them know about the difference in division and modulus but we revisit this. Now when we use division(/) operator with operands then it gives results as quotient and when we use modulus(%) operator with operands then the result is remainder. Example as mention above table.

Now you have great knowledge about the arithmetic operators and from examples of the above table. Below I share arithmetic operators in c with example program. In this program, you have to enter two integer numbers and then c arithmetic operators work on operands.

`#include<stdio.h>`
int main()
{
int a,b;
printf(" \n Enter two numbers");
scanf("%d%d",&a,&b);
printf("\n Addition of a and b: %d \t",(a+b));
printf("\n Subtraction of a and b: %d \t",(a-b));
printf("\n Multiplication of a and b: %d \t",(a*b));
printf("\n Divide of a and b: %d \t",(a/b));
printf("\n Modulus of a and b: %d \t",(a%b));
return 0;
}

The program asks the user for two operands and then to perform arithmetic operations in C on numbers.

```
Enter Two Numbers 15 3
Addition of a and b: 18
Subtraction of a and b: 12
Multiplication of a and b: 45
Division of a and b: 5
Modulus of a and b: 0
```

You have any problem with these** **arithmetic operators in C. Do not hesitate and write your problem in the comment box. I will support your problem.

Happy Coding 😊

Source: Internet