Python program to find the largest of three numbers

 

Python program to find the largest of three numbers accepted from the user

Problem Definition

Develop a python program to accept three numbers from the user using an input statement and find the largest of three numbers.

Video Tutorial:

Source code of Python program to find the largest of three numbers

n1 = int (input("Enter the 1st number: "))
n2 = int (input("Enter the 2nd number: "))
n3 = int (input("Enter the 3rd number: "))
if (n1 > n2):
    if (n1 > n3):
        print ("1st number is the largest number")
    else:
        print ("3rd number is the largest number")
elif (n2 > n3):
    print ("2nd number is the largest number")
else:
    print ("3rd number is the largest number")

Output:

Case 1:

Enter the 1st number: 10

Enter the 2nd number: 11

Enter the 3rd number: 12

3rd number is the largest number

Case 2:

Enter the 1st number: 11

Enter the 2nd number: 13

Enter the 3rd number: 12

2nd number is the largest number

Case 3:

Enter the 1st number: 13

Enter the 2nd number: 12

Enter the 3rd number: 11

1st number is the largest number

Summary:

This tutorial discusses how to develop a program to accept three numbers from the user using an input statement and find the largest of three numbers. If you like the tutorial share it with your friends. Like the Facebook page for regular updates and YouTube channel for video tutorials.

Leave a Comment

Your email address will not be published. Required fields are marked *

Welcome to VTUPulse.com


Computer Graphics and Image Processing Mini Projects -> Click Here

Download Final Year Project -> Click Here

This will close in 12 seconds