Tuesday 6 February 2024

Class 11 CS Practical - 03

 

3. Write a program in Python to Input two numbers and display the smaller number.


a=int(input("Enter First Number: "))

b=int(input("Enter Second Number: "))

if a<b:

    print(a," is smaller than ",b)

elif b<a:

    print(b,"is smaller than ",a)

else:

    print("Both numbers are equal")

 

Output:

Enter First Number: 5

Enter Second Number: 3

3  is smaller than  5

 

Enter First Number: 6

Enter Second Number: 9

6 is smaller than  9

 

Enter First Number: 5

Enter Second Number: 5

Both numbers are equal


No comments:

Post a Comment