Q:

# C++ program to Find Largest of three numbers using nested if

belongs to collection: C++ Number Solved Programs

Write a C++ program to Find Largest of three numbers using nested if. Here’s simple program to Find Largest of three numbers using nested if in C++ Programming Language.

Here is source code of the C++ program to Find Largest of three numbers using nested if. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.

### SOURCE CODE : :

``````/*  C++ program to Find Largest of three numbers using nested if  */

#include<iostream>
using namespace std;

int main()
{

int a, b, c;
cout <<"Enter 1st number :: ";
cin>>a;
cout <<"\nEnter 2nd number :: ";
cin>>b;
cout <<"\nEnter 3rd number :: ";
cin>>c;

if(a>=b && a>=c)
{
cout<<"\nThe Largest number among [ "<<a<<", "<<b<<", "<<c<<" ] is :: "<<a<<"\n";
}
if(b>=a && b>=c)
{
cout<<"\nThe Largest number among [ "<<a<<", "<<b<<", "<<c<<" ] is :: "<<b<<"\n";
}
if(c>=a && c>=b)
{
cout<<"\nThe Largest number among [ "<<a<<", "<<b<<", "<<c<<" ] is :: "<<c<<"\n";
}

return 0;
}``````

### Output : :

```/*  C++ program to Find Largest of three numbers using nested if  */

Enter 1st number :: 5

Enter 2nd number :: 2

Enter 3rd number :: 7

The Largest number among [ 5, 2, 7 ] is :: 7

Process returned 0```

Above is the source code for C++ program to Find Largest of three number using nested if which is successfully compiled and run on Windows System.The Output of the program is shown above .