# C++ To Perform All Arithmetic Operations Using Switch Case

Problem :- Write A C++ To Perform All Arithmetic Operations Using Switch Case .

Logic :- Take two Number and pass it in Switch Case ,first write all the case then write a code according to statement .if you want to see more like C Program To Find The Day Using Switch Case

Solution :-

#include<iostream>
using namespace std;
int main()
{
float a,b,rem;
int ch,q;

cout<<"Arithmetic Operatios";
cin>>ch;

switch(ch)
{
case 1:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B ";
cin>>a>>b;
rem=a+b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
break;

case 2:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
rem=a-b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
break;

case 3:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
rem=a*b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
break;

case 4:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
if(a>=b)
{
rem=a/b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
else
cout<<"\nt 1st Varable Should Be Greater Than 2nd.  !!!";
cout<<"\n";
}
break;

case 5:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
if(a>=b)
{
q=a/b;
rem=a-(b*q);
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
else
cout<<"\nt 1st Varable Should Be Greater Than 2nd.  !!!";
cout<<"\n";
}
break;
}

return 0;
}

Output:-