In this python if else program, we will print the largest number from two numbers.
Steps to solve the program
- Take two numbers as input through the user.
- Check which of them is a greater number using the if-else statement.
- Print the largest number.
num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))
if num1>num2:
print(f"{num1} is greatest")
else:
print(f"{num2} is greatest")
Output :
Enter 1st number: 54
Enter 2nd number: 21
54 is greatest
Related Articles
Python program to check whether a given character is uppercase or not.
Python program to check whether the given character is lowercase or not.
Python program to check whether the given number is an integer or not.
Python program to check whether the given number is float or not.
Python program to check whether the given input is a string or not.
Python program to print all the numbers from 10-15 except 13.