write a python program that asks the user for a number and then prints out a list of all the divisors of that number
Answers
Answered by
3
Answer:
Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don’t know what a divisor is, it is a number that divides evenly into another number. For example, 13 is a divisor of 26 because 26 / 13 has no remainder.)
unfortunately, my program doesn't return the divisor values for a given number. Here is my code :
print('Enter a number to know its divisors :')
number = int(input())
while number > 1:
inf = number - 1
result = number % inf
if result == 0:
print (inf)
Could you please tell me where is my error ? I would also like your comments on how to make this program more simple if possible.
Similar questions