Saturday, 3 March 2012

Read three numeric values from the user, and then print the largest of the three in python

#programme for python language
#output will be largest value


-def InputVal(x,y,z):  #logic for highest value
    print 'values are ',x,y,z
    if (x>y)and(x>z):
        print'a is largest=>',x
    elif(x<y)and(y>z):
        print 'b is largest=>',y
    else:
        print'c is largest=>',z

-def Main():
    a=input("Enter first value:")
    b=input("Enter second value:-")
    c=input("Enter third value:-")
    InputVal(a,b,c)
Main()     

No comments:

Post a Comment

Compiler for C,C++ and Python {paste your programme to see the output}