# C++ Program to Perform Addition Subtraction Multiplication Division

## Addition, Subtraction, Multiplication, and Division in C++

To perform addition, subtraction, multiplication and division of any two numbers in C++ Programming, you have to ask to the user to enter the two number and then ask to enter the operator to perform the particular mathematical operation (addition, subtraction, multiplication, and division) and display the result on the screen.

## C++ Programming Code for Addition Subtraction Multiplication Division

Following C++ program ask to user to enter the two number and perform addition, subtraction, multiplication and division on the two entered number:

C++ Programming Example Source Code:
```/* C++ Program - Addition, Subtraction, Multiplication, Division */

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a, b, res;
cout<<"Enter two number :";
cin>>a>>b;
res=a+b;
res=a-b;
cout<<"\nSubtraction = "<<res;
res=a*b;
cout<<"\nMultiplication = "<<res;
res=a/b;
cout<<"\nDivision = "<<res;
getch();
}```

When the above C++ program is compile and executed, it will produce the following result:

Following C++ program ask to the user to enter the two number along with operator to perform particular operation (addition, subtraction, multiplication and division) according to the user:

```#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a, b;
char ch;
cout<<"Enter first Number :";
cin>>a;
cout<<"Enter second Number :";
cin>>b;
cout<<"Enter operator (+, -, *, /) :";
cin>>c);
if(ch=='+')
cout<<"Result = "<<a+b;
else if(ch=='-')
cout<<"Result = "<<a-b;
else if(ch=='*')
cout<<"Result = "<<a*b;
else if(ch=='/')
cout<<"Result = "<<a/b;
else
cout<<"Wrong Operator!!!";
getch();
}```

When the above C++ program is compile and executed, it will produce the following result:

### Same Program in Other Language

You may like the same program in other programming languages:

Tools
Calculator