#include<iostream>
#include<conio.h>
using namespace std;
int main()
{ int number,a,b,c,sum,sum2,mul,swap;
cout<<" MANU OF PROGRAM"<<endl<<endl;
cout<<"press 1: Add 2 two numbers"<<endl<<endl;
cout<<"press 2: Add and multiply 3 numbers "<<endl<<endl;
cout<<"press 3: Enter two numbers and find maximum"<<endl<<endl;
cout<<"press 4: Enter two numbers and find minimum"<<endl<<endl;
cout<<"press 5: Enter a value and find even or odd"<<endl<<endl;
cout<<"press 6: Enter two values and swap them"<<endl<<endl;
cout<<"press a number 1-6"<<endl;
cin>>number;
if(number==1)
{ cout<<"Enter two numbers to add"<<endl;
cin>>a>>b;
sum=a+b;
cout<<"sum is = "<<sum<<endl;
}
else if(number==2)
{cout<<"Enter three numbers to add and multiply"<<endl;
cin>>a>>b>>c;
sum2=a+b+c;
mul=a*b*c;
cout<<"Sum is = "<<sum2<<endl;
cout<<"product is = "<<mul<<endl;
}
else if(number==3)
{cout<<"Enter two numbers to find maximum number"<<endl;
cin>>a>>b;
if (a>b)
cout<<a<<" is maximum"<<endl;
else if(b>a)
cout<<b<<" is maximum"<<endl;
}
else if(number==4)
{ cout<<"Enter two values to find minimum number "<<endl;
cin>>a>>b;
if(a<b)
cout<<a<<" is minimum"<<endl;
else if(b<a)
cout<<b<<" is minmum"<<endl;
}
else if(number==5)
{cout<<"Enter a number to find whether it is even or odd"<<endl;
cin>>a;
if(a%2==0)
cout<<a<<" is even"<<endl;
else
{
cout<<a<<" is odd"<<endl;}
}
else if(number==6)
{cout<<"Enter two values to swap"<<endl;
cin>>a>>b;
cout<<"you enter ("<<a<<","<<b<<")"<<endl;
swap=a;
a=b;
b=swap;
cout<<"values are swap = ("<<a<<","<<b<<")"<<endl;
}
else
cout<<"Enter values 1-6"<<endl;
getch();
}
No comments:
Post a Comment