#K541. Find All Factors

    ID: 29678 Type: Default 1000ms 256MiB

Find All Factors

Find All Factors

Given a non-negative integer (n), your task is to compute all the factors of (n) in ascending order. A factor (k) of (n) is defined as an integer such that (n \mod k = 0). If (n = 0), then by definition, it has no factors and the output should be empty.

Example: For (n = 12), the factors are: 1, 2, 3, 4, 6, 12.

inputFormat

The input consists of a single non-negative integer (n) provided via standard input.

outputFormat

Output the factors of (n) in ascending order, separated by single spaces. If (n = 0), output an empty line.## sample

12
1 2 3 4 6 12