# Find largest of two numbers

Find largest of two numbers is c++ program to find largest of two numbers.

In this tutorial we are going to one simple and easy program in cpp programming which is to find largest of two numbers.

How to find largest of two numbers.

First we take two numbers input from user. Then using the condition statement in cpp we write a condition to check which number is large. Depending on that we print the result.

Example :

Number 1 = 10 and number 2 =30

if(number 1 > number 2)

number 1 is large

else

number 2 large

In above example number 1=10 and number 2 =30, then condition is checked number 1 > number 2 condition false so else block true. that is number is large.

Algorithm to find large of two number

1. Start
2. Declare variables
3. Take numbers input from user.
4. Write condition to check which number is large
5. if first number is large then print number 1 is large.
6. else print number 2 large
7. End

## C++ Program to Find Largest of Two Numbers

Output :

Explanation:

1. Execution starts with the main function.

2. Declare the variables

num1 => to store first number

num2 => to store second number

3. Next we take two input

cin>>num1; => num1= 10

cin>>num2; => num2= 20

4. Next we write the condition to check large number among two

if(num1>num2)  => 10 > 20  this condition becomes false and if block skipped

5. and else block get executed

cout<<“Second number “<<num2<<” is the largest”;

=>Second number 20 is the largest