Programming Examples

Python program to print factor of given number


Write a Python program to input any number and print all factors of input number.

A factor is a number that divides into another number exactly and without leaving a remainder.

Sample:

Input : 12

Output : Factor of 12 are : 1,2,3,4,6 ,12 

Solution

num=int(input("Enter any Number : "))
print("Factor of ",num," are : ",end='')
for a in range(1,num):
    if num%a==0:
        print(a,end=',')
print(num)
Output

Enter any Number : 12

Factor of  12  are : 1,2,3,4,6,12

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2025 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz