Capgemini interview question

Solve this pseudo code for the c++ code?