FIS interview question

Write pseudo code to solve this problem.