Nokia Interview Question

problem solving in c and c++.