# Program to find minimum of 3 numbers
# (user enters numbers)
# Matt Bishop, May 1, 2009
# for ECS 10 Spring 2009
# this routine finds the minimum of 3 numbers using a cascade method
# parameters: a, b, c: the three numbers
# returns: smallest of a, b, c
def least(a, b, c):
minim = a;
if b < minim:
minim = b;
if c < minim:
minim = c;
return minim;
# get 3 numbers and print minimum; also handle bogus input
# calls: least
def main():
try:
# get input and print result
a,b,c = input("enter three comma-separated numbers: ");
print "The minimum of", a, "and", b, "and", c, "is", least(a, b, c);
# now handle errors
except NameError:
print "Bad form for input -- did you enter three numbers?"
except SyntaxError:
print "Bad form for input -- did you forget commas?"
main();