Kyrexar

Factores primos

Oct 20th, 2021
647
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def factores(x):
  2.     res = str(x) +" = "
  3.     for i in range(2, x):
  4.         while x%i==0:
  5.             res += str(i) + "*"
  6.             x/=i
  7.     print(res[:-1])
  8.  
  9. x=2
  10. while(x>0):
  11.     x = int(input("Numero (0=salir)?"))
  12.     factores(x)
RAW Paste Data