Q:

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

belongs to collection: C++ Basic Solved Programs

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Basic Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C++ program to Check whether a number is palindrom... >>
<< C++ Program to Check whether a Number is Armstrong...