program to find the largest of three numbers in python code example
Example 1: program to find the largest of three numbers in python
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)
Example 2: program to find the largest of three numbers in python
n1=float(input("Enter number 1: "))
n2=float(input("Enter number 2: "))
n3=float(input("Enter number 3: "))
if n1 > n2 :
if n1 > n3 :
LNo=n1
else :
LNo=n3
else :
if n2 >n3 :
LNo=n2
else :
LNo=n3
print("DISPLAY........")
print("Number 1 : ",n1)
print("Number 2 : ",n2)
print("Number 3 : ",n3)
print("Largest number is : ",LNo)