Pergunta de entrevista da empresa Neo Financial

Write a pseudo code for the following problem.