C++ Program to Demonstrate the Working of Arithmetic Operators

In this program, you will learn the working of arithmetic operators. An arithmetic operator performs mathematical operations such as addition, subtraction, multiplication, division etc on numerical values (constants and variables).



Source Code
#include <iostream>
using namespace std;

int main()
{
    int a = 45, b = 6, c;

    c = a + b;
    cout<<"a+b = "<<c;

    c = a-b;
    cout<<"\na - b = "<<c;

    c = a * b;
    cout<<"\na * b = "<<c;

    c=a / b;
    cout<<"\na/b = "<<c;

    c=a % b;
    cout<<"\na mod b = "<<c;

    return 0;
}
Output
a+b = 51
a-b = 39
a*b = 270
a/b = 7
a mod b = 3