Arithmetic Operators


C supplies all arithmetic operators. Operators work in the same way as +, -, *, and / all other languages. These can work on any built-in data type allowed in C. Thus, a number preceded by a minus sign changes its sign.

Arithmetic Operators

Operator Meaning
+ Addition or unary plus
- Subtraction or unary minus
* Multiplication
/ Division
% Modulo division

Integer divides any fraction. The modulus division operation produces the remainder of an integer division. Examples of using arithmetic operators:

Program
// Arithmetic Operators
#include <stdio.h>

int main() {
  int a = 20, b = 10;
  printf("Two numbers are (a,b) = %d %d \n",a,b);
  printf("Addition = %d\n",a + b);
  printf("Subtraction = %d\n",a - b);
  printf("Multiplication = %d\n",a * b);
  printf("Division = %d\n",a / b);
  printf("Modulus = %d\n",a % b);
  return 0;
}