#C12479. Find Factor Pairs
Find Factor Pairs
Find Factor Pairs
Given a positive integer (n), find all unique pairs of positive integers ((a, b)) such that (a \times b = n) and (a \leq b).
List the pairs in increasing order based on the first element (a). If (n = 0), there are no valid pairs and the program should output nothing.
For example:
• For (n = 12), the pairs are: ((1, 12)), ((2, 6)), and ((3, 4)).
• For (n = 9), the pairs are: ((1, 9)) and ((3, 3)).
inputFormat
The input consists of a single integer (n) provided via standard input.
outputFormat
For each valid factor pair ((a, b)) such that (a \times b = n), output a line with the two integers separated by a space. If no pairs exist (for example, when (n = 0)), output nothing.## sample
12
1 12
2 6
3 4
</p>