Taking input of five numbers from the user
a=int(input("Enter the value of a:"))
b=int(input("Enter the value of b:"))
c=int(input("Enter the value of c:"))
d=int(input("Enter the value of d:"))
e=int(input("Enter the value of e:"))
if a>b:
if a>c:
if a>d:
if a>e:
print(a,"is the largest")
elif b>a:
if b>c:
if b>d:
if b>e:
print(b,"is the largest")
elif c>a:
if c>b:
if c>d:
if c>e:
print(c,"is the largest")
elif d>a:
if d>b:
if d>c:
if d>e:
print(d,"is the largest")
else:
print(e,"is the largest")
The if branching is only working if a and b have the largest values and not working fro the rest
Aucun commentaire:
Enregistrer un commentaire