Python Program To Print All Divisors Of An Integer Number

This program prints all divisors of a given integer number in Python language.

In this Python program, we first read number from user. Then we print all divisors using for loop and if statement.

Python Source Code: Divisors of Number


# Divisors of a number

number = int(input("Enter number: "))

print("\nDivisors of %d are: " %(number))
for i in range(1, number+1):
    if number%i == 0:
        print(i, end=" ")

Output

Enter number: 234

Divisors of 234 are: 
1 2 3 6 9 13 18 26 39 78 117 234