Skip to content
Tactiverge
Level 3DebuggingWrite a program

Debug: one seven too many

This program should read n and output the number 7 exactly n times. It prints one 7 too many, and prints a 7 even when n is 0. Fix it.

Public tests

  • input 0 → no output
  • input 1 → 7
  • input 3 → 7, 7, 7
  • input 5 → 7, 7, 7, 7, 7

Scored on correctness: every test must pass. Skills: loop tests, off-by-one.

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.