# Arithmetic, logical and relational operators

Arithmetic operators
OperatorDetils
-Subtraction of two operands
*Multiplication of two operands
/Division of two operands
%Reminder of a division
++Increment by one
--Decrement by one
Examples of Arithmetic Operators.
``````#include <stdio.h>
int main()
{
int x=30 ,y=20;
int result;

result = x + y; // Addition
printf(" Output : %d \n", result);

result = x - y; // Subtraction
printf(" Output : %d \n", result);

result = x * y; // Multiplication
printf(" Output : %d \n", result);

result = x / y; // Division
printf(" Output : %d \n", result);

result = x % y; // reminder of the Division
printf(" Output : %d \n", result);
}``````
output
`````` Output : 50
Output : 10
Output : 600
Output : 1
Output : 10``````
Logical operators
OperatorDetils
&&And operator. Output true only if all operands are true
||Or operator. Output true if any one of the operand is true
!Not operator. True if out put of condition is false
Examples ( Output is after comment )
``````#include <stdio.h>
int main()
{
int x=40 ,y=50;
int result;

result= (x==40) && (y ==30);
printf(" Output : %d \n", result );  //  0

result= (x==40) || (y ==30);
printf(" Output : %d \n", result );  //  1

result= !(x==40) || (y ==30);
printf(" Output : %d \n", result );  // 0
}``````

## Relational operators

Here output is always True or False. It can be 1 or 0
OperatorDetils
==Equal To
<Less than
>Greater than
<=Less than or equal to
>=Greater than or equal to
!=Not equal to Example of Relational Operators ( output are shown with comments )
``````#include <stdio.h>
int main()
{
int x=30 ,y=20;

printf(" Output : %d \n", x == y);  // 0
printf(" Output : %d \n", x <  y);  // 0
printf(" Output : %d \n", x >  y);  // 1
printf(" Output : %d \n", x <= y);  // 0
printf(" Output : %d \n", x >= y);  // 1
printf(" Output : %d \n", x != y);  // 1
}`````` plus2net.com