Python Program to Find the Largest Among Three Numbers

By | October 3, 2021
Python Program to Find the Largest Among Three Numbers

In this Python tutorial, you will learn how to write a python program to find the Largest Number Among Three numbers.

Prerequisite topics to create this program.

Steps

Vamware
  • First, we ask the user to enter 3 numbers.
  • Using the float() function we will convert the entered values into floating number values.
  • Using the if….elif  statement and comparison operators, we check for conditions.

Python Program to Find the Largest Among Three Numbers

Code:

num_1 = float(input("Enter First Number: "))
num_2 = float(input("Enter Second Number: "))
num_3 = float(input("Enter the Third Number: "))

if num_1 > num_2 and num_1> num_3:
    print("The largest number is:", num_1)
elif num_2 > num_1 and num_2>num_3:
    print("The largest number is:", num_2)
else:
    print("The largest number is:", num_3)

 

Output 1:

Enter First Number: 19
Enter Second Number: 19
Enter the Third Number: 20
The largest number is: 20.0

Output:2

Enter First Number: 1009 Enter Second Number: 123 Enter Third Number: 2652 The largest number is: 2652.0

People are also reading:

Leave a Reply

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