Pergunta de entrevista da empresa CU Direct

How would you improve this code?