×
☰ Menu

Arithmetic operators in C

 

Operator

Meaning 

+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo Division

 

 

Code: 

#include <stdio.h>

main() {

   int a = 10;
   int b = 5;
   int c ;

   c = a + b;
   printf("a+b=%d\n", c );
	
   c = a - b;
   printf("a-b=%d\n", c );
	
   c = a * b;
   printf("a*b=%d\n ", c );
	
   c = a / b;
   printf("a/b=%d\n ", c );
	
   c = a % b;
   printf("a modulo b=%d\n ", c );
	
 
}

 

Output: 

a+b=15
a-b=5
a*b=50
 a/b=2
 a modulo b=0

--------------------------------
Process exited after 0.7947 seconds with return value 0
Press any key to continue . . .