# How do you Find the Factors of a Number Program?

We used the for loop to find factors of a number program below. Read the steps given below for a more detailed explanation.

Step 1: Choose any number

Step 2: Put every number ranging from 1 to that number in a loop

Step 3: If the number is divided evenly, without leaving any remainder behind then that is a factor.

                    
Source Code:

numb=int(input("enter any number"))

facts=[]

for a in range(1,numb+1):

if numb%a==0:

facts.append(a)

print ("Factors of {} = {}".format(numb,facts))

Output

enter a number 6

Factors of 6 = [2, 3]



#### Related Topics

Share with friends

## Customize your course in 30 seconds

##### Which class are you in?
5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.
Ashhar Firdausi
IIT Roorkee
Biology
Dr. Nazma Shaik
VTU
Chemistry
Gaurav Tiwari
APJAKTU
Physics
Get Started