# Simple Arithmetic Operators Example Program In C++

C++Server Side ProgrammingProgramming

#### C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Master C and Embedded C Programming- Learn as you go

66 Lectures 5.5 hours

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