HCLTech interview question

Basic C++