Write a Python Program to Find the Factors of a Number

Python Program to Find the Factors of a Number

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn  Python programming concepts. You can learn Python language at your own speed and time. One can learn concepts of Python language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

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

Write a Python Program to Find the Factors of a Number

PROGRAM: Python 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)

OUTPUT :-

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

Leave a Reply

Your email address will not be published. Required fields are marked *