write a python program to accept two numbers find the greatest and print the result
Answers
Answer:
Get two inputs num1 and num2 from user using input() method check whether num1 is greater than num2 using if statement.
if num1 is greater print num1 using print() method, else check whether num2 is greater than num1 using elseif statement.
If num2 is greater print num2 using print() method, else print num1 and num2 are equal using print() method.
Answer:
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
#Compare both the number
if num1 >= num2:
if num1 == num2:
print("Both numbers are equal.")
else:
print("Fisrt number is greater than the second number.")
else:
print("Second number is greater than the First number.")
Explanation:
declaring two numbers
comparing two numbers using if else loop
printing the result