NTT DATA interview question

write code on paper and be correct for syntax