#include<conio.h>
#include<iostream.h>
void main()
{
clrscr();
int a,b;
char c;
cout<<"Enter the vslue for a and b\n";
cin>>a>>b;
cout<<"Enter the operators(+,-,* and /)\n";
cin>>c;
switch(c)
{
case '+': cout<<a+b;break;
case '-': cout<<a-b;break;
case '*': cout<<a*b;break;
case '/': cout<<a/b;break;
default: cout<<"Wrong Input";break;
}
getch();
}
Coding Format
#include<iostream.h>
void main()
{
clrscr();
int a,b;
char c;
cout<<"Enter the vslue for a and b\n";
cin>>a>>b;
cout<<"Enter the operators(+,-,* and /)\n";
cin>>c;
switch(c)
{
case '+': cout<<a+b;break;
case '-': cout<<a-b;break;
case '*': cout<<a*b;break;
case '/': cout<<a/b;break;
default: cout<<"Wrong Input";break;
}
getch();
}
Coding Format
Output Format
No comments:
Post a Comment