# Largest Amongst Three Numbers

“** Largest Amongst Three Numbers**” is very basic programming Exercise problem. Here, we are given three numbers, entered by user and our task is to write a program to find the largest amongst three number.

**Example (Largest Amongst Three Numbers):**

Num1 = 10 Num2 = 20 Num3 = 30INPUT:30 is largest numberOUTPUT

As we have only three numbers, we will simply check every number with other two remaining number to find the largest amongst three numbers.

**C++ Program to find largest amongst three numbers is as follows:**

/* C++ Program to find largest amongst three numbers */ #include<bits/stdc++.h> using namespace std; int main() { int num1,num2,num3; // Scanning the numbers cout<<"Enter the first Number: "; cin>>num1; cout<<"Enter the second Number: "; cin>>num2; cout<<"Enter the third Number: "; cin>>num3; int largest; // check if first number is largest if(num1 >= num2 && num1 >= num3) { largest = num1; } // check if second number is largest else if(num2 >= num1 && num2 >= num3) { largest = num2; } // check if third number is largest else if(num3 >= num1 && num3 >= num2) { largest = num3; } //Printing the largest number cout<<"The largest number is "<<largest; }

Enter the first Number: 10 Enter the second Number: 20 Enter the third Number: 30 The largest number is 30OUTPUT:

**Related Posts:**

- Program to find factorial of a number.
- Program to find GCD of two numbers.
- Program to find LCM of two numbers.
- Program to check whether entered number is odd or even.
- Program to check whether entered number is prime number or not.
- Program to check whether entered number is palindrome or not.
- Program to check whether entered number is Armstrong Number or Not.
- Program to convert binary number to octal number.
- Program to convert binary number to decimal number.
- Program to convert binary number to hexadecimal number.
- Program to convert octal number to binary number.
- Program to convert octal number to decimal number.
- Program to convert octal number to hexadecimal number.
- Program to convert decimal number to binary number.
- Program to convert decimal number to octal number.
- Program to convert decimal number to hexadecimal number.
- Program to convert hexadecimal number to binary number.
- Program to convert hexadecimal number to octal number.
- Program to convert hexadecimal number to decimal number.
- Program to check Leap Year.