Ingram Industries interview question

coding question is given basic one to write.