#include<iostream.h>
#include<conio.h>
void main()
{
float a,b,z;
char oper;
clrscr();
cout<<"\nEnter First Number A = ";
cin>>a;
cout<<"\nEnter Second Number B = ";
cin>>b;
cout<<"\nChose Your Operation";
cout<<"\n--------------------";
cout<<"\n1 - Addition";
cout<<"\n2 - Substraction";
cout<<"\n3 - Product";
cout<<"\n4 - Division";
cout<<"\n--------------------\n";
cin>>oper;
cout<<"\nResult:\n\n";
switch(oper)
{
case '1':
z=a+b;
cout<<"A + B = "<<z;
break;
case '2':
z=a-b;
cout<<"A - B = "<<z;
break;
case '3':
z=a*b;
cout<<"A * B = "<<z;
break;
case '4':
z=a/b;
cout<<"A / B = "<<z;
break;
default:
cout<<"Invalid Choice";
}
getch();
}
#include<conio.h>
void main()
{
float a,b,z;
char oper;
clrscr();
cout<<"\nEnter First Number A = ";
cin>>a;
cout<<"\nEnter Second Number B = ";
cin>>b;
cout<<"\nChose Your Operation";
cout<<"\n--------------------";
cout<<"\n1 - Addition";
cout<<"\n2 - Substraction";
cout<<"\n3 - Product";
cout<<"\n4 - Division";
cout<<"\n--------------------\n";
cin>>oper;
cout<<"\nResult:\n\n";
switch(oper)
{
case '1':
z=a+b;
cout<<"A + B = "<<z;
break;
case '2':
z=a-b;
cout<<"A - B = "<<z;
break;
case '3':
z=a*b;
cout<<"A * B = "<<z;
break;
case '4':
z=a/b;
cout<<"A / B = "<<z;
break;
default:
cout<<"Invalid Choice";
}
getch();
}
No comments:
Post a Comment