Write a C++ program that performs all mathematical operations on two variables.

 


#include<iostream>

using namespace std;

int main()

{

int a,b;

a = 10;

b = 5;

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

cout<<" a - b = "<<a+b<<endl;

cout<<" a * b = "<<a+b<<endl;

cout<<" a / b = "<<a+b<<endl;

cout<<" a % b = "<<a+b<<endl;

}

OUTPUT

 a + b = 15

 a - b = 15

 a * b = 15

 a / b = 15

 a % b = 15

No comments:

Post a Comment