Amazon interview question

Basic C code algorithm, need to write it down, not typing