Pregunta de entrevista de Knorr-Bremse

it was a cpp/c problem but easy.