Finding The Greater Number From The Given 3 Numbers :))
1)
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c,great;
clrscr();
cout<<"\n Enter the First Number: ";
cin>>a;
cout<<"\n Enter the second number: ";
cin>>b;
cout<<"\n Enter the Third Number: ";
cin>>c;
if((a>b) && (a>c))
great=a;
else if((b>a) && (b>c))
great=b;
else
great=c;
cout<<"\n The great Number Is : "<<great;
getch();
}
2)
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
cout<<"\n Enter the Values: ";
cin>>a>>b>>c;
if(a>b)
{
if(a>c)
cout<<a<<" is great";
else
cout<<c<<" is great";
}
else if(b>c)
cout<<b<<" is great";
else
cout<<c<<" is great";
getch();
}
Here is the Output :))
No comments:
Post a Comment