Skip to content

Commit

Permalink
Changed few lines
Browse files Browse the repository at this point in the history
  • Loading branch information
dheeru0198 committed Apr 12, 2012
1 parent 1e3bb1a commit c2a8cfb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions prob3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
# Problem - 3
# Find the largest prime factor of a composite number.

from math import sqrt

c = int(raw_input("Enter any Composite number : "))
i = 2
j = 1
cnt = 0
i = 3

def is_prime(n) :
for j in range(2, int(sqrt(n)) + 1) :
if (n % j == 0) :
return 0
return 1

while i < c :
while (i < c) :
if c % i == 0 :
x = c / i
while j < x :
if x % j == 0 :
cnt = cnt + 1
j = j + 1
j = 1
if (cnt == 1) :
if is_prime(x) :
lpf = x
break
cnt = 0
i = i + 1
i += 1
print lpf

0 comments on commit c2a8cfb

Please sign in to comment.