Wednesday, October 18, 2023

Python Programming - Lab- Core Lab 5 - Bsc CS DA -Bharathiar University - Program 2 - Write a python program to find the largest three integers using if-else and conditional operator.

 

 B.Sc Computer Science with Data Analytics  

Python Programming - Lab

Core Lab 5  

Bharathiar University 

Program 2 - Write a python program to find the largest three integers using if-else and conditional operator.

Source Code

# Taking user input for three integers
a = int(input("Enter first integer: "))
b = int(input("Enter second integer: "))
c = int(input("Enter third integer: "))
# Find the largest among the three integers using if-else and conditional operators
largest = a if a > b and a > c else (b if b > c else c)


# Displaying the largest number
print("The largest number among", a, ",", b, "and", c, "is:", largest)


OUTPUT:
Enter first integer: 50
Enter second integer: 76
Enter third integer: 23
The largest number among 50 , 76 and 23 is: 76

No comments:

Post a Comment

Program 12 BCA Madras University BCA Object Oriented Programming using C++ Practical Madras University Program 12 Implement a telephone directory using files

  BCA Object Oriented Programming using C++ Practical Madras University  Program 12  Implement a telephone directory using files SOURCE CODE...