Pergunta de entrevista da empresa Reserve Bank of Australia

Convert this pseudo code to C#