# Simple Arithmetic Operators Example Program In C++

C++Server Side ProgrammingProgramming

C++ has 5 basic arithmetic operators. They are −

• Subtraction(-)
• Division(/)
• Multiplication(*)
• Modulo(%)

These operators can operate on any arithmetic operations in C++. Let's have a look at an example −

## Example

#include <iostream>
using namespace std;
main() {
int a = 21;
int b = 10;
int c ;
c = a + b;
cout << "Line 1 - Value of c is :" << c << endl ;

c = a - b;
cout << "Line 2 - Value of c is  :" << c << endl ;

c = a * b;
cout << "Line 3 - Value of c is :" << c << endl ;

c = a / b;
cout << "Line 4 - Value of c is  :" << c << endl ;

c = a % b;
cout << "Line 5 - Value of c is  :" << c << endl ;
return 0;
}

## Output

This will give the output −

Line 1 - Value of c is :31
Line 2 - Value of c is  :11
Line 3 - Value of c is :210
Line 4 - Value of c is  :2
Line 5 - Value of c is  :1
Published on 15-Feb-2018 12:03:19