Using Venn diagram for the students, 13 students have dog, 8 have cat and only 1 student do not have a dog or a cat
In the diagram, the circle at the left represents the set of students who have do and the circle at the right represents the set of students who have cat.
Total students = 30
dog = 21 students
cat = 16 students
dog and cat = 8 students
only dog = 21 - 8 = 13 students
only cat = 16 - 8 = 8 students
13 + 8 + 8 = 29
30 students - 29 students = 1 student
Therefore, out of the 30 students, only 13 students have dog, 8 have cat and only 1 student do not have a dog or a cat.