Sunday 21 December 2014

Calculator

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,d,e,f,g;
cout<<"Enter two number:";
cin>>a>>b;
cout<<"Enter your choice:";
cin>>c;
switch(c)
{
case 1:
d=a+b;
cout<<d;
break;
case 2:
e=a-b;
cout<<e;
break;
case 3:
f=a*b;
cout<<f;
break;
case 4:
g=a/b;
cout<<g;
break;
default:
cout<<"Invalid Operator";
}
getch();
}

No comments:

Post a Comment