#include <iostream.h>
void main()
{
char var1;
int a,b;
cout<<"Enter the first number: "<<endl;
cin>>a;
cout<<"Enter +,-,/ or * "<<endl;
cin>>var1;
cout<<"Enter the second number: "<<endl;
cin>>b;
switch(var1){
case '+':
cout<<"the sum is : " <<a+b<<endl;
break;
case '-':
cout<<"the answer is : "<<a-b<<endl;
break;
case '*':
cout<<"the multiple is : "<<a*b<<endl;
break;
case '/':
cout<<"the division is : "<<a/b<<endl;
break;
default:
cout<<"enter correct elements please....."<<endl;
}
}
THE OUTPUT WILL BE.......
No comments:
Post a Comment