Soru 1

mail@pastecode.io avatar
unknown
python
2 years ago
315 B
3
Indexable
Never
import math 

def primeFactors(n):
   while n % 2 == 0:
      print (2),
      n = n / 2
      
   for i in range(3,int(math.sqrt(n))+1,2):
     
      while (n % i == 0):
         print (i)
         n = n / i
    
   if n > 2:
      print (n)
      
val = int(input("Enter a positive integer: "))
primeFactors(val)