Python Online Compiler
Example: Python program to find factors of a number using for loop
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# Python program to find factors of a number using for loop print ("Enter the positive integer number: ", end="") random_number = int (input ()) print ("The factors of the ", random_number, "are: ", end="") for i in range (1, random_number + 1): if random_number % i == 0: print (i, end=" ") print (end="\n")
60
Output
Clear
ADVERTISEMENTS