Computer Science, asked by pavankalyan22119992, 8 months ago

Lucy has entered to Narnia through the wardrobe. Once she enters to Narnia, she is encountered with a genie. Genie takes care of Narnia from trespassers. As Genie finds Lucy to be genuine, Genie allows Lucy to enter Narnia if she answers his question. He gives Lucy two numbers and asks her to perform the basic arithmetic operation like addition, subtraction etc. She need to perform the same and tell the answer. If she tells right answer, she gets the pass to Narnia.
The input should consists of two integers and the operation to be performed which should be corresponding integer. Print the Menu as

Addition(+)
Subtraction(-)
Multiplication(*)
Division(/)
Remainder(%)

Answers

Answered by manoj2425
0

Answer:

# include <iostream>

using namespace std;

int main()

{

int num1, num2,menu;

cout<<"Enter first number :";

cin >> num1;

cout<<" Enter second number :";

cin>>num2;

cout<<" Menu";

cin >> menu;

  cout<<"\n1.Addition";

   cout<<"\n2.Subtraction";

   cout<<"\n3.Multiplication";

   cout<<"\n4.Division";

   cout<<"\n5.Remainder\n";

switch(menu)

   {

   

       case 1:

   

           cout << num1+num2;

           break;

 case 2:

   

           cout << num1-num2;

           break;

       case 3:

   

           cout << num1*num2;

           break;

       case 4:

   

           cout << num1/num2;

           break;

   case 5:

   

           cout << num1%num2;

           break;

       default:

           cout <<"Invalid operation";

           break;

   }

   return 0;

}

Explanation:

Answered by anchu2899
0

Answer:

#include <iostream>

using namespace std;

int main()

{

 int n1;

 int n2;

 int Menu;

 cout<<"Enter first number : ";

 cin>>n1;

 cout<<"Enter second number : ";

 cin>>n2;

 cout<<"Menu\n";

 cin>>Menu;

 cout<<"1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n5.Remainder";

 int Add,Sub,Mul,Div,Rem;

 cout<<endl;

 switch(Menu){

   case 1:Add=n1+n2;

    cout<<Add;

   break;

   case 2:Sub=n1-n2;

   cout<<Sub;

   break;

   case 3:Mul=n1*n2;

   cout<<Mul;

   break;

   case 4:Div=n1/n2;

   cout<<Div;

   break;

   case 5: Rem=n1%n2;

   cout<<Rem;

   break;

   default:cout<<"Invalid operation";

}

}

Explanation:

Similar questions