The 3's Game

Easy
math divisibility conditionals loops
Problem Description

For every number from 1 to N, print "Three" if divisible by 3 (but not 9), "DoubleThree" if divisible by 9, or the number itself otherwise.

Input Format
A single integer N.
Output Format
N lines, each containing either the number, "Three", or "DoubleThree".
Constraints
• 1 ≤ N ≤ 100
• Check divisibility by 9 first, then by 3
• Numbers divisible by 9 show 'DoubleThree'
• Numbers divisible by 3 (but not 9) show 'Three'
• All other numbers show the number itself
Sample Input/Output
Input:
12
Output:
1
2
Three
4
5
Three
7
8
DoubleThree
10
11
Three
Explanation

3,6,12 are divisible by 3 → "Three". 9 is divisible by 9 → "DoubleThree". Others remain as numbers.

Solution Hints
35
Points
1000ms
Time Limit
64MB
Memory Limit
Code Editor
Register to Submit
Register to Access Code Editor

Create a free account to solve coding problems and track your progress.

Register Now
Feedback