#B2043. Divisibility by 3, 5, and 7
Divisibility by 3, 5, and 7
Divisibility by 3, 5, and 7
Given an integer \( x \), determine which of the numbers \(3\), \(5\), and \(7\) divide \( x \) evenly. The output should be as follows:
- If \( x \) is divisible by all three numbers \(3\), \(5\), and \(7\), output:
3 5 7
. - If \( x \) is divisible by exactly two of these numbers, output the two divisors in ascending order (for example,
3 5
,3 7
, or5 7
). - If \( x \) is divisible by exactly one of these numbers, output that divisor.
- If \( x \) is not divisible by any of them, output a lowercase letter
n
.
Note that divisibility means that the remainder when \( x \) is divided by the divisor is zero, i.e. \( x \bmod d = 0 \).
inputFormat
The input consists of a single integer \( x \), which can be positive, negative, or zero.
outputFormat
Output the divisor(s) of \( x \) among \(3\), \(5\), and \(7\) (in ascending order) separated by a single space. If \( x \) is not divisible by any of these, output the lowercase letter n
.
sample
105
3 5 7