Capgemini interview question

basic logic and c