Pergunta de entrevista da empresa Infinitas Learning Holding

How would you go about improving this code? What is wrong with this code?