Skip to content

Commit baaa57c

Browse files
Merge pull request geekcomputers#370 from Ahish9009/patch-3
Update factors.py
2 parents feb67b3 + b57bc39 commit baaa57c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

factors.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import math
2+
13
print('The factors of the number you type when prompted will be displayed')
24
a = int(input('Type now // '))
3-
b = a
4-
while b > 0:
5+
b = 1
6+
while b <= math.sqrt(a):
57
if a % b == 0:
6-
print(b)
7-
b -= 1
8+
print("A factor of the number is ", b)
9+
print("A factor of the number is ", int(a/b))
10+
b += 1

0 commit comments

Comments
 (0)