Python program to find the largest among three numbers
Here in this example, you will get the source code of python program to find the largest among three numbers. In this program we will get three numbers as input, find out the results(largest number)using nested if else, and then print the result.
Example of python program to find the largest among three numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #find Largest of Three Numbers in Python def largestNumber(x, y, z): if x > y and x > z: largest = x elif y > x and y > z: largest = y else: largest = z return largest a = int(input("Enter first Number: ")); b = int(input("Enter second Number: ")); c = int(input("Enter Third Number: ")); big=largestNumber(a, b, c); print("Largest number is ",big); |
Output
Enter first Number: 4
Enter second Number: 3
Enter Third Number: 2
Largest number is 4
Check out our other Python examples