Find the largest number among three numbers.

In this python if else program, we will find the largest number among three numbers.

Hint:
Use nested if-else statements.
Use > operator.

Steps to solve the program
  1. Take 3 numbers as input through the user.
  2. Find the largest number among three numbers using logic and if else statements.
  3. Print the output.
				
					num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))
num3 = int(input("Enter 3rd number: "))

if num1>num2:
    if num1>num3:
        print(f"{num1} is the greatest")
    else:
        print(f"{num3} is the greatest")
else:
    if num2>num3:
        print(f"{num2} is the greatest")
    else:
        print(f"{num3} is the greatest")
				
			

Output :

				
					Enter 1st number: 55
Enter 2nd number: 41
Enter 3rd number: 50
55 is the greatest
				
			

Related Articles

determine whether a given number is available in the list

check any person eligible to vote or not

Leave a Comment