python-dev avatar

Python Program to Find the Factors of a Number

python-dev

Published: 22 Mar 2020 › Updated: 22 Mar 2020Python Program to Find the Factors of a Number

Python Program to Find the Factors of a Number

# Python Program to find the factors of a number

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

num = 320

print_factors(num)

Leave Python Program to Find the Factors of a Number to:

Written by

Read more #python-dev posts


Best Posts From python-dev

We have not curated any of python-dev's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From python-dev