Tuesday, 6 February 2024

Class 11 CS Practical - 04

 

4. Write a program in Python to Input three numbers and display the largest 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 largest number")

elif b>=a and b>=c:

    print(b," is largest number")

else:

    print(c," is largest number")

Output:

 

Enter First Number: 6

Enter Second Number: 7

Enter Third Number: 8

8  is largest number

 

Enter First Number: 8

Enter Second Number: 7

Enter Third Number: 4

8  is largest number

Enter First Number: 5

Enter Second Number: 9

Enter Third Number: 7

9  is largest number

 

Enter First Number: 7

Enter Second Number: 7

Enter Third Number: 7

7  is largest number

No comments:

Post a Comment