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
>>>

By cbsepython

A complete solution for the students of class 9 to 12 having subject Information Technology (402), Computer Science (083). Explore our website for all the useful content as Topic wise notes, Solved QNA, MCQs, Projects and Quiz related to the latest syllabus.

Copywrite © 2020-2024, CBSE Python,
All Rights Reserved