Python Program to find largest number of 3 numbers
In this example shows, how to find the largest of three given numbers.
Steps
- Takes three numbers as input from the user
- Using if-elif-else to determine which one is the largest.
- The largest number is displayed as the output.
Here is an example Python program to find the largest of 3 numbers.
Example.py
a=int(input("Enter the First number : ")) b=int(input("Enter the Second number : ")) c=int(input("Enter the Third number : ")) lrg=int() if b>a: lrg=b elif lrg<c: lrg=c else: lrg=a print("The Largest number is ", lrg)
Output 1
Enter the First number : 80 Enter the Second number : 42 Enter the Third number : 11 The Largest number is 80
Output 2
Enter the First number : 24 Enter the Second number : 42 Enter the Third number : 11 The Largest number is 42