C provides all the basic arithmetic operators.they are listed with sysntax and it example,in arithmetic operators +,-,*, and / operator work same as another programming languages,the following list and example of all arithmetic operator in c programming language.
Sr.No |
Operators |
Descriptions |
---|---|---|
01 |
+ |
Addition |
02 |
- |
Subtraction |
03 |
* |
Multiplication |
04 |
/ |
Division |
05 |
% |
Modulo |
This operator is perform addition of two value the following syntax and example of addition operator in c.
Syntax
value1 + value2
Example
#include
int main()
{
int a, b, c;
printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);
c = a + b;
printf("Sum of entered numbers = %d\n",c);
return 0;
}
This operator is perform subtraction of two value the following syntax and example of addition operator in c.
Syntax
value1 - value2
Example
#include
int main()
{
int a, b, c;
printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);
c = a - b;
printf("Sum of entered numbers = %d\n",c);
return 0;
}
This operator is perform multiplication of two value the following syntax and example of addition operator in c.
Syntax
value1 * value2
Example
#include
int main()
{
int a, b, c;
printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);
c = a * b;
printf("Sum of entered numbers = %d\n",c);
return 0;
}
This operator is perform division of two value the following syntax and example of addition operator in c.
Syntax
value1 / value2
Example
#include
int main()
{
int a, b, c;
printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);
c = a / b;
printf("Sum of entered numbers = %d\n",c);
return 0;
}
This operator is return reminder of two value the following syntax and example of addition operator in c.
Syntax
value1 % value2
Example
#include
int main()
{
int a, b, c;
printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);
c = a % b;
printf("Sum of entered numbers = %d\n",c);
return 0;
}