This C++ Program demonstrates the use of arithmetic operators. Here numbers are given as input and the result of operation is output on the screen.

Here is source code of the C++ program which demonstrates the use of arithmetic operators. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.

`/*`

`* C++ program to demonstrate use of arithmetic operators`

`*/`

`#include<iostream>`

`using namespace std;`

int main()

`{`

int Num1, Num2;

cout << "Enter two numbers to be operated with arithmetic operators: ";

cin >> Num1 >> Num2;

cout << endl;

cout << "Num1 + Num2 = " << Num1 + Num2 << endl;

cout << "Num1 * Num2 = " << Num1 * Num2 << endl;

cout << "Num1 - Num2 = " << Num1 - Num2 << endl;

if (Num2 != 0)

cout << "Num1 / Num2 = " << Num1 / Num2 << endl;

`else`

cout << "Num2 is not non-zero. Division is not defined. " << endl;

return 0;

`}`

$ g++ main.cpp $ ./a.out Enter two numbers to be operated with arithmetic operators: 4 6 Num1 + Num2 = 10 Num1 * Num2 = 24 Num1 - Num2 = -2 Num1 / Num2 = 0 $ ./a.out Enter two numbers to be operated with arithmetic operators: 5 0 Num1 + Num2 = 5 Num1 * Num2 = 0 Num1 - Num2 = 5 Num2 is not non-zero. Division is not defined.

**Sanfoundry Global Education & Learning Series – 1000 C++ Programs.**

If you wish to look at all C++ Programming examples, go to C++ Programs.