Python program to find Prime Factors of a Number

n=int(input("Enter an integer:"))
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

OUTPUT:

Case 1:
Enter an integer:25
Factors are:
5
Case 2:
Enter an integer:200
Factors are:
2
5

Leave a Comment