Help me in solving LB02B problem

My issue

Explain the logic in this program.

Learning course: C for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone

The logic is if z%x==0 and z%y==0 then print “any”.
if only z%x==0 then answer would be “chicken”.
if only z%y==0 then answer would be “duck”.
and for else cases “none”.