# C++ Program to find the largest of three numbers using the function

In this program, You will learn how to find the largest of three numbers using function in C++.

```
10 20 30 => 30
22 11 10 => 22
```

## Example: How to find the largest of three numbers using a function in C++.

```
#include<iostream>
using namespace std;
int checkNumber(int a, int b, int c) {
if (a > b && a > c)
return a;
else if (b > c)
return b;
else
return c;
}
int main() {
int a, b, c, lar;
cout << "Enter three numbers:";
cin >> a >> b >> c;
lar = checkNumber(a, b, c);
cout << "Largest is:" << lar;
return 0;
}
```

#### Output:

```
Enter three numbers:30 20 10
Largest is:30
```