Magic
CodeChefOpen on judge ↗
Yogesh loves numbers. He loves to find weird relations between numbers. One of his favourite things to do is add the digits of random numbers he finds. If the sum of digits is greater than 9 he adds the digits once more. He continues to do this until he obtains a single digit sum. If this sum is equal to 1, he calls it a magic number. But he often loses track and finds himself irritated. Help Yoge
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start