Input two numbers and display the larger/smaller number Python Program 

 

# Python Program to input 2 numbers and display larger number

 

#input first number

num1=int(input("Enter First Number"))

#input Second number

num2=int(input("Enter Second Number"))

#Check if first number is greater than second

if (num1>num2):

    print("The Larger number is", num1)

else:
    print ("The Larger number is", num2)



 

Output:

Enter First Number23
Enter Second Number35
The Larger number is 35
>>>

 

 

# Python Program to input 2 numbers and display Smaller number

 

#input first number

num1=int(input("Enter First Number"))

#input Second number

num2=int(input("Enter Second Number"))

#Check if first number is lesser than second

if (num1<num2):

    print("The Smaller number is", num1)

else:
    print ("The Smaller number is", num2)



 

Output:

Enter First Number23
Enter Second Number35
The Smaller number is 23
>>>
Copywrite © 2020-2024, CBSE Python,
All Rights Reserved