Print all prime factors of a number using Python - CodeSpeedy
www.codespeedy.com › print-all-prime-factors-of-anum = int(input("ENTER A NUMBER : ")) for i in range(2,num + 1): if(num % i == 0): prime = True for j in range(2,(i//2 + 1)): if(i % j == 0): prime = False break if(prime): print("%d"%i,end=' ') print("ARE THE PRIME FACTORS OF NUMBER",num) Python program output. The above Python program prints all the prime factors of a number. The output of this program after sample execution is given below-siddharth@siddharth-Lenovo-Y520-15IKBN:~/python$ python3 factors.py ENTER A NUMBER : 35 5 7 ARE THE ...