In "C " language we can carryout basic arithmetic operation like addition, subtraction, multiplication and division.
Both unary and binary are Arithmetic Operator.
Arithmetic Operators
Operator | Meaning | Example |
+ | Addition | 7 + 3 = 10 |
- | Subtraction | 10 - 3 = 7 |
* | Multiplication | 5 * 2 = 10 |
/ | Division | 10 / 2 = 5 |
% | Modulus | 9 % 2 = 1 |
// Arithmetic Operators
#include<stdio.h>
int main()
{
int X=16,Y=10,Z;
Z=X+Y;
printf("X+Y=%d\n",Z);
Z=X-Y;
printf("X-Y=%d\n",Z);
Z=X*Y;
printf("X*Y=%d\n",Z);
Z=X/Y;
printf("X/Y=%d\n",Z);
Z=X%Y;
printf("X%%Y=%d\n\b",Z);
return 0;
}
Output
X+Y=26X-Y=6
X*Y=160
X/Y=1
X%Y=6