C++ source code for sum,pro,sub,div,mod.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.
C++ Program to Perform Addition, Subtraction, Multiplication and Division
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int x,y,sum,pro,sub,div,mod;
x=10;
y=5;
sum=x+y;
pro=x*y;
sub=x-y;
div=x/y;
mod=x%y;
cout<<"sum of x and y="<<sum<<endl;
cout<<"pro of x and y="<<pro<<endl;
cout<<"sub of x and y="<<sub<<endl;
cout<<"div of x and y="<<div<<endl;
cout<<"mod of x and y="<<mod<<endl;
getch();
}
Output of Program
sum of x and y=15
pro of x and y=50
sub of x and y=5
div of x and y=2
mod of x and y=0