Arithmetic Operators in C

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

Addition (+)

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;
}							
							

Subtraction (-)

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;
} 							
							

Multiplication (*)

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;
} 			 							
							

Division (/)

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;
} 			 							
							

Modulo (%)

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;
} 			  							
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!