Tuesday, 6 February 2024

Class 11 CS Practical - 05

 

5. Write a program in Python to Input three numbers and display the smallest number.


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

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

c=int(input("Enter Third Number: "))

if a<=b and a<=c:

    print(a," is smallest number")

elif b<=a and b<=c:

    print(b," is smallest number")

else:

    print(c," is smallest number")

Output:

Enter First Number: 8

Enter Second Number: 5

Enter Third Number: 6

5  is smallest number

Enter First Number: 7

Enter Second Number: 9

Enter Third Number: 2

2  is smallest number

 

Enter First Number: 4

Enter Second Number: 6

Enter Third Number: 9

4  is smallest number

No comments:

Post a Comment