Advertisements
Advertisements
Question
Write program to input any number and print all factors of that number.
Code Writing
Advertisements
Solution
Check every number from 1 to the given number; a factor leaves remainder 0.
n = int(input("Enter any number: "))
for i in range(1, n + 1):
if n % i == 0:
print(i)shaalaa.com
Is there an error in this question or solution?
