Write a Python Program to print Prime Factors of an Integer


Topic: Write a Python Program to print Prime Factors of an Integer

Solution

n=24
print("Factors are:")
i=1
while(i<=n):
    k=0
    if(n%i==0):
        j=1
        while(j<=i):
            if(i%j==0):
                k=k+1
            j=j+1
        if(k==2):
            print(i)
    i=i+1



List all Python Programs