Python program to find the largest among three numbers

Python program to find the largest among three numbers

In this example, we will learn how to find the largest among three numbers.

For this first of all we will take three numbers and then with the help of if–elif–else ladder we will find the largest among three numbers.

n1= int ( input ( ‘ Enter First Number : ‘ ) )
n2= int ( input ( ‘ Enter Second Number : ‘ ) )
n3= int ( input ( ‘ Enter Third Number : ‘ ) )
if ( ( n1 > n2 ) and ( n1 > n3 ) ):
print( ‘ {0} is the largest number’.format(n1)  )
elif( ( n2 > n1 ) and ( n2 > n3 ) ):
print( ‘ {0} is the largest number’.format(n2)  )
else:
print( ‘ {0} is the largest number’.format(n3)  )

Output

Enter First Number : 7
Enter Second Number : 12
Enter Third Number : 5
12 is the largest number

If you like my post please share it with your friends by simply clicking the below social media button, and Don’t forget to comment so we will update ourselves.

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *