Python Program to Find the Largest Number Among Three Numbers​

Find the Largest Number Among Three Numbers​

The Python program to calculate the greatest of three numbers which requires the user to insert three integers. A simple If-Elif-Else block is used to identify the greatest number. The program will ask the user to insert three integer variables. And on the basis of the inserted number, the program will evaluate and compare the greatest number as an output. This program uses three integer variables that are represented first, second and third respectively in the program.
For Example:
Enter first number:45
Enter second number:56
Enter third number:41
Second is Greater than First and Third
Python Program to Find the Largest Number Among Three Numbers​

Working:

Step 1: Start

Step 2: Insert the value for three integer variables first, second, third.

Step 3: If first is greater than second and third , print “First is Greater than Second and Third”.

Step 4: If second is greater than first and third, print “Second is Greater than First and Third”.

Step 5: If both the conditions are false, else print “Third is Greater than First and Second”.

Step 6: Stop

 

Python Program:

first = int(input("Enter first number:"))
second = int(input("Enter second number:"))
third = int(input("Enter third number:"))

if first > second and first > third:
    print("First is Greater than Second and Third")
elif second > first and second > third:
    print("Second is Greater than First and Third")
else:
    print("Third is Greater than First and Second")

# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student) 

Output:

Enter first number:45
Enter second number:56
Enter third number:41
Second is Greater than First and Third