HCLTech interview question

1. solve very common c++ proboems