Divisors in order

Write a program to print in order all the divisors of a given number.

Input

Input consists of several cases, each with a natural number n between 1
and 10⁹.

Output

For every n, print the divisors of n in increasing order.

Observations

- Your program must be “efficient” to be accepted by the judge.

- You are not allowed to use vectors or alike.

Hint

Every divisor smaller than the square root of n has a corresponding
divisor greater than the square root of n. It could be useful to make
two loops, one for “small” divisors, and another for “large” divisors.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T10:40:15.214Z

© Jutge.org, 2006–2026.
https://jutge.org
