Arithmetic operations using arithmetic symbols

Arithmetic operations using arithmetic symbols :

The program to perform the arithmetic operation using arithmetic symbols is given in the post below:

Code:

// Arithmetic Operations using characters

#include<iostream>
using namespace std;
int main()
{
int a, b;
char option;
cout << "Enter 1st No = ";
cin >> a;
cout << "Enter 2nd No = ";
cin >> b;
cout << "For Sum Press + \n" << "For Subtraction Press -\n" << "For Multiplication Press *\n" << "For Division Press /\n";
cin >> option;
if (option == '+')
{
cout << "Sum = " << a + b<<endl;
}
else if (option== '-')
{
cout << "Subtraction = " << a - b<<endl;
}
else if (option== '*')
{
cout << "Multiplication = " << a * b<<endl;
}
else if (option== '/')
{
cout << "Division = " << a / b<<endl;
}
else
{
cout << "Invalid Option ";
}
}

Download:

To download this program click on the given link below:

Comments

Popular posts from this blog

How to Run Assembly Language Programming Code In Visual Studio 2019

Boss Home Appliances

How to Display Character in Assembly language