Introduction

Control Statement

- Program to find factorial of the number
- Program to find reverse of the number
- Program to Check Armstrong Number
- Program to find the sum of Natural Numbers using Recursion
- Calculator Program
- Program to identify day of week
- Program to print Fibonacci series
- Check Whether the Number is Even or Odd in C++
- Program to check whether the number is prime or not

Function

- Program to find reverse of the sentence using Recursion
- Program to Shutdown and restart Computer
- Program to find the area of triangle
- Program to find LCM
- Program to check prime number using Functions
- Program to convert Binary to Decimal Number
- Program to convert Decimal to Binary Number
- Program to convert Binary to Octal Number
- Program to convert Octal to Binary Number

Array

Pointer

OOPS

No Examples found for this topic - CodeHelpPro

# Program to check the largest number among three numbers

In this example, We will learn how to check the largest number among three numbers using the C++ programming language.

To understand this example, You must have the knowledge of

In this example, We we will ask for three numbers and compare each numbers to get largest number. Let’s look an example to make clear concepts:

```
#include <iostream>
using namespace std;
int main() {
float n1, n2, n3;
cout << "Enter three numbers: ";
cin >> n1 >> n2 >> n3;
if(n1 >= n2 && n1 >= n3)
cout << "Largest number: " << n1;
else if(n2 >= n1 && n2 >= n3)
cout << "Largest number: " << n2;
else
cout << "Largest number: " << n3;
return 0;
}
```

The output of above program is

```
Enter three numbers : 5, 7, 9
Largest Number: 9
```

Subscribe

Login

0 Comments

Inline Feedbacks

View all comments