python basic programs

# to find greater among three numbers
num1 = int(input("Enter 1st number:"))
num2 = int(input("Enter 2nd number:"))
num3 = int(input("Enter 3rd number:"))
max = num3
if (num2 > max):
    max = num2
if (num1 > max):
    max = num1
print("The greatest value is:",max)





# 2 program To find greatest number among three numbers
n1 = int(input("Enter 1st number:"))
n2 = int(input("Enter 2nd number:"))
n3 = int(input("Enter 3rd number:"))
if (n1 > n2) and (n1 > n3):
    print("n1 is the greatest number")
if (n2 > n1) and (n2 > n3):

    print("n2 is the greatest number")
if (n3 > n1) and (n3 > n2):
    print("n3 is the greatest number")




# to find greater number among three using elif condition
n1 = int(input("Enter 1st no.:"))
n2 = int(input("Enter 2nd no.:"))
n3 = int(input("Enter 3rd no.:"))
max = n2
if (n1 > max):
    max = n1
elif(n3 > max):
    max = n3
print("the greatest value is:",max)














python basic programs python basic programs Reviewed by Hack on September 12, 2019 Rating: 5

No comments:

Powered by Blogger.