Tuesday, 6 February 2024

Class 11 CS Practical - 02


2. Write a program in Python to Input two numbers and display the larger number.

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

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

if a>b:

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

elif b>a:

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

else:

    print("Both numbers are equal")

 

Output:

Enter First Number: 5

Enter Second Number: 3

5  is greater than  3

 

Enter First Number: 6

Enter Second Number: 9

9 is greater than  6

 

Enter First Number: 5

Enter Second Number: 5

Both numbers are equal


No comments:

Post a Comment