Answer to Question #303058 in Python for Loki

Question #303058

Create a Python script which will accept a positive integer and will display


the DIVISORS of the input number.



Sample Output:


Input a Positive Integer : 20


The DIVISORS of 20 are…


1 2 4 5 10 20

1
Expert's answer
2022-02-27T04:23:34-0500
print("Enter a Positive Integer: ", end='')
n = int(input())
print(f"The DIVISORS of {n}: ", end='')
for i in range(1, n+1):
    if n % i == 0:
       print(i, end= ' ')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS