C++ Program to Find Largest Number Among Three Numbers

To understand this example, you should have the knowledge of the following C++ programming topics:


In this program, the user is asked to enter three numbers.

Then this program finds out the largest number among three numbers entered by user and displays it with a proper message.

This program can be written in more than one way.


Example 1: Find Largest Number Using if...else Statement

Output

Enter three numbers: 2.3
8.3
-4.2
Largest number: 8.3

Example 2: Find the Largest Number Using Nested if...else statement

Output

Enter three numbers: 2.3
8.3
-4.2
Largest number: 8.3