Python - Smallest of 3 given numbers
Here is the python program to find the smallest of 3 given numbers. This code is tested with Python version 2.6
print "Program to find smallest of three numbers"
a = 0
b = 0
c = 0
print "Enter First Number:",
a = input()
print "Enter Second Number:",
b = input()
print "Enter Third Number:",
c = input()
small = c
if (a < b and a < c):
small = a
elif(b < c):
small = b
print "Smallest of (", a, ",", b, ",", c, ") is: ", small
#sample output
#Program to find smallest of three numbers
#Enter First Number: 10
#Enter Second Number: 20
#Enter Third Number: 30
#Smallest of ( 10 , 20 , 30 ) is: 10
|
|