NTT DATA interview question

simple programs and logic. followed by debugging