Skip to content
Tactiverge
Level 4DebuggingWrite a program

Debug: zero is a number too

This program should read n and output 1 + 2 + … + n (wrapped to 8 bits), and 0 when n is 0. It is right for every n except 0. Fix it without breaking the others.

Public tests

  • input 0 → 0
  • input 1 → 1
  • input 4 → 10
  • input 10 → 55

Scored on correctness: every test must pass. Skills: edge cases, loop guards.

New to this? Silicon Studio 15: A simple virtual processor

How results are computed: model assumptions.

One instruction per line. Labels end with a colon, comments start with a semicolon. Numbers can be 12, 0x0C or 0b1100.