Computer Science, asked by anuragmishra142000, 18 days ago

Aamir Khan is suffering from short term memory loss and he has forgotten how to
add, subtract, multiply,modulo division and division. Write a C++ program to help Aamir t
perform the basic arithmetic operations.
INPUT & OUTPUT FORMAT:
Input consists of two integers. Output consist of integers​

Answers

Answered by sg07818
4

Answer:

#include <iostream>

using namespace std;

int main()

{

int a,b;

cin>>a>>b;

int sum=a+b;

int sub = a-b;

int div = a/b;

int mod= a%b;

int mul= a*b;

char op;

cin>>op;

if(op=='+')

cout<<sum;

else if(op=='-')

cout<<sub;

else if(op=='*')

cout<<mul;

else if(op=='/')

cout<<div;

else if(op=='%')

cout<<mod;

return 0;

}

Answered by pragyakirti12345
0

Answer:

Explanation:

// A C++ program to perform following operations - add, subtract, multiply, modulo, and division.

#include <iostream>

using namespace std;

int main()

{

int a, b;

cin>>a>>b;

int sum=a+b;

int sub = a-b;

int mul= a*b;

int div = a/b;

int mod= a%b;

char op;

cin>>op;

if(op=='+')

cout<<sum;

else if(op=='-')

cout<<sub;

else if(op=='*')

cout<<mul;

else if(op=='/')

cout<<div;

else if(op=='%')

cout<<mod;

return 0;

}

#SPJ3

Similar questions