May 17th, 2019

Abhijeet Pal: Python Program to Find the Largest Among Three Numbers

Python, by admin.

Problem Definition

Create a Python program to find the largest among the three given numbers.

Solution

  1. Take inputs from the user and store them in variables
  2. Compare the numbers
  3. Print the final result
  4. End

To understand the program you need to have an understanding of following Python concept.

Program

num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
 
if (num1 > num2) and (num1 > num3):
   largest = num1
elif (num2 > num1) and (num2 > num3):
   largest = num2
else:
   largest = num3
 
print("The largest number is",largest)

Runtime Test Cases

Enter first number: 1
Enter second number: 2
Enter third number: 3
The largest number is 3.0

The post Python Program to Find the Largest Among Three Numbers appeared first on Django Central.

Back Top

Comments are closed.