Pregunta de entrevista de 89 Degrees

Asked to write a simple code on a whiteboard.