Cognizant interview question

Write a C program for the Digital gate