Kyrexar

Factores primos

Oct 20th, 2021
1,205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment