Find Factors of a number Python

PROGRAM TO FIND FACTORS OF A NUMBER


# This function computes the factor of the argument passed
def
   print("The factors of",x,"are:")
   for i in range(1, x + 1):
       if x % i == 0:
           print(i)

num = 320

print_factors(num)


OUTPUT
The factors of 320 are:
1
2
4
5
8
10
16
20
32
40
64
80
160
320

Comments

Popular posts from this blog

Solve the Sudoku Python

Solve the Sudoku Java

Find Duplicates Java