Write a program to compare three numbers and print the largest one.

 Q. Write a program to compare three numbers and print the largest one.

Code:-

a = float(input("Enter first number:"))
b = float(input("Enter second number:"))
c = float(input("Enter third number:"))

if (a>=b) and (a>=c):
  largest = a
elif (b>=a) and (b>=c):
  largest = b
else:
  largest = c

print("The largest number is", largest)

Output:-



















Comments