C++ Program find the greatest number using nested if else

Share on facebook
Share on linkedin
Share on twitter
Share on email
Use "ufd6qb86" For Offers

            

Result :

find the greatest number using nested if else



//find the greatest number using nested if else

#include<iostream>

using namespace std;

main()

{ 

 int a, b, c;

 

 cout << "This Program will Help you to find out greatest number amoung 3 numbers." << endl;

 

 cout << "Enter the 1st Value : ";

 cin >> a;

 

 cout << "Enter the 2nd Value : ";

 cin >> b;

 

 cout << "Enter the 3rd Value : ";

 cin >> c;



if(a >= b)

{

 if( a >= c)

 {

  cout << a << " : is greater than " << b << " and " << c;

 }

 else

 {

   cout << c << " : is greater than " << a << " and " << b;

 }

 

}

else

{

 if( b >= c)

 {

  cout <<  b << " : is greater than " << a << " and " << c;

 }

 else

 {

  cout <<  c << " : is greater than " << a << " and " << b;

 }

 

}



 

 return 0;

}
Get 20% Off on Trading Fee Use "LG3RJV7Z"

More To Explore

Use "ufd6qb86" For Offers