0% found this document useful (0 votes)
17 views1 page

Simple Calculator

Uploaded by

Akshit Dahiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

Simple Calculator

Uploaded by

Akshit Dahiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Experiment No:1

AIM: WRITE A PROGRAM FOR A SIMPLE CALCULATOR

#include <iostream>
using namespace std;

int main()
{
int a, b;
char op;

cout << "Enter the two numbers" << endl;


cin >> a >> b;

cout << "Choose the operation to be performed" << endl;


cin >> op;

switch (op)
{
case '+':
cout << "The sum of two numbers is " << a + b;
break;

case '-':
cout << "The subtraction of two numbers is " << a - b;
break;

case '*':
cout << "The multiplication of two numbers is " << a *
b;
break;

case '/':
cout << "The division of two numbers is " << a / b;
break;

default:
cout << "Error! Operator is not correct";
}
return 0;
}

You might also like