Cognizant interview question

Write C code for basic series pattern type questions