Tech Mahindra interview question

basic of C, Java