#include<iostream>
using namespace std;
int main()
{
char ch;
int a,b,result;
cout<<"enter two value "<<endl;
cin>>a>>b;
cout<<"enter the operator";
cin>>ch;
switch(ch)
{
case '+':
result=a+b;
cout<<result;
break;
case '-':
result=a-b;
cout<<result;
break;
case '*':
result=a*b;
cout<<result;
break;
case '/':
result=a/b;
cout<<result;
break;
default:
cout<<"enter correct operator";
break;
}
}
using namespace std;
int main()
{
char ch;
int a,b,result;
cout<<"enter two value "<<endl;
cin>>a>>b;
cout<<"enter the operator";
cin>>ch;
switch(ch)
{
case '+':
result=a+b;
cout<<result;
break;
case '-':
result=a-b;
cout<<result;
break;
case '*':
result=a*b;
cout<<result;
break;
case '/':
result=a/b;
cout<<result;
break;
default:
cout<<"enter correct operator";
break;
}
}
No comments:
Post a Comment