Pregunta de entrevista de Sonata Software

Write a program.in c with explaining the logic behind