Header Ads

Python - WAP to Print the Divisor of any given Number in Python - 15

This is a Python Code to Print the Divisor of any given Number using Python.

Source Code:

#!/usr/bin/python3

while True:

    num = int(input("Enter a Number : "))

    reg = 0

    print ("The Divisors are : ")
    for idx in range(1, num+1):
        if ( num % idx == 0):
            print (" " , idx)

    if (input("To Continue 'y' : ") == 'y' ):
        continue
    else:
        break

Program Output: 

No comments