Discovergy interview question

Find the error in this code Read the question and explain how you would program it. Program it now yourself. You could choose any programming language you want. (C, python, C++ ...)