Tuesday, 31 July 2018

Mathematical Functions

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>

void main()
{
int n1,n2,ch;
clrscr();
cout<<"\nMain menu ";
cout<<"\n[1] ADD  ";
cout<<"\n[2] SUB  ";
cout<<"\n[3] MUL  ";
cout<<"\n[4] DIV  ";
cout<<"\nEnter choice: ";
cin>>ch;
cout<<"\nEnter two numbers: ";
cin>>n1>>n2;

switch(ch)
{
case 1: cout<<"\nSum = "<<n1+n2; break;
case 2: cout<<"\nSub = "<<n1-n2; break;
case 3: cout<<"\nMul = "<<n1*n2; break;
case 4: cout<<"\nDiv = "<<n1/n2; break;
default : cout<<"\nwrong choice";
}
getch();

}



===========================================================================


                                OUTPUT



No comments:

Post a Comment