Posts by Kurono • 1 point
2 posts
-
-2
votes2
answers378
viewsA: Prime Numbers with While and For
I solved a task similar to this using while structure, see: div=2 cont=0 resto=1 while resto!=0: if numero<2: resto=0 break resto=numero%div cont+=1 div=(2*cont)+1 if div==numero: break if…
-
-1
votes4
answers4581
viewsA: How to multiply in Python without the multiplication operator?
I have an answer in that form, but it only works for natural numbers. n1=int(input("Fator:")) n2=int(input("Fator:")) x=1 soma=n1 while x<n2: soma=soma+n1 x=x+1 print(f"Resultado: {soma}")…