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