I do not know how I can get out of the if after the continue, since an infinite cycle is done

2
print ("Ingrese hasta que numero multiplo de 5 quiere sumar")
x= int(input())
y=5
num=x%y
while x>0:
    if num==0:
        print("Numero correcto")
        break
    if num!=0:
        print("Numero incorrecto, ingrese nuevamente")
        x= int(input())
        continue
    
asked by william 25.05.2018 в 07:14
source

1 answer

2

Try this:

print ("Ingrese hasta que numero multiplo de 5 quiere sumar")
x= int(input())
y=5
num=x%y
while x>0:
    if num==0:
        print("Numero correcto")
        break
    else:
        print("Numero incorrecto, ingrese nuevamente")
        x= int(input())
        num=x%y
        continue

The only thing I've done has been to change your if num!=0: to else . Also in the else after asking again the number x=int(input()) , I have put again the operation num=x%y .

I've tried it and it works. I hope it serves you.

    
answered by 25.05.2018 в 09:16