Python program to find the smallest of three numbers

 

Python program to find the smallest 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 smallest of three numbers.

Video Tutorial:

Source code of Python program to find the smallest 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 smallest number")
    else:
        print ("3rd number is the smallest number")
elif (n2 < n3):
    print ("2nd number is the smallest nuumber")
else:
    print ("3rd number is the smallest number")

Output:

Case 1:

Enter the 1st number: 10

Enter the 2nd number: 11

Enter the 3rd number: 9

3rd number is the smallest number

Case 2:

Enter the 1st number: 11

Enter the 2nd number: 10

Enter the 3rd number: 12

2nd number is the smallest number

Case 3:

Enter the 1st number: 10

Enter the 2nd number: 12

Enter the 3rd number: 11

1st number is the smallest number

Summary:

This tutorial discusses how to develop a program to accept three numbers from the user using an input statement and find the smallest 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