Tuesday, July 22, 2025

WTP in python : Input three numbers and print the largest one

# Number Comparison

# Input three numbers and print the largest one.


# Logic Recap:

# First, check if num1 is greater than or equal to both num2 and num3.

# If not, check if num2 is greater than or equal to both num1 and num3.

# If neither is true, then num3 must be the largest.



num1=int(input("Please enter the first number: "))

num2=int(input("Please enter the second number: "))

num3=int(input("Please enter the third number: "))



if(num1 >= num2 and num1 >=num3):

    print(f"{num1} is the largest")

elif(num2>=num1 and num2 >=num3):

    print(f"{num2} is largest ")

else:

    print(f"{num3} is largest ") 

No comments:

Post a Comment