I like this answer. Since number of students, who ate the cake, is different in the statement of each student, therefore only one statement can be true; and since only one statement is true and four are lies, so four lying students ate the cakes and one telling the truth did not eat. So obviously fourth student did not eat cake and he is telling the truth.