25th April 2nd homework question .I need help in the logic

I need help in the logic . Please solve it as soon as possible.