#t229. 判断能否被 3, 5, 7 整除
判断能否被 3, 5, 7 整除
Divisibility by 3, 5, and 7
Problem Description
Given an integer, determine whether it is divisible by , , and , and output the following information:
- If it is divisible by all of (output
3 5 7, with a single space between each number); - If it is divisible by exactly two of them (output the two numbers, smaller first, larger second — e.g.
3 5or3 7or5 7, separated by spaces); - If it is divisible by exactly one of them (output that divisor);
- If it is divisible by none of them, output the lowercase letter
n.
Input Format
One line containing a single integer.
Output Format
One line containing the divisibility information as described above.
Sample Input
105
Sample Output
3 5 7
Hint
- Three independent checks; output whichever condition(s) are satisfied (in the order , , ).
- When none is satisfied, output
nitself — reread the statement to confirm. - Multiple numbers on the same line: build the spaces yourself.
- Verify with the sample:
105→3 5 7.