Answer:
21 students have both a dog and a cat as pets.
Step-by-step explanation:
Total students in the class = 45
Fraction of students having dog as a pet = 
Number of students having dos as a pet ,D= 
Fraction of students having dog as a cat as a pet= 
Number of students having dos as a pet ,C= 
Students having both cat and dog as a pet = D∪C
D∪C = 45
D∪C = D + C - D∩C
45 = 36+ 30 - D∩C
D∩C = 66 - 45 = 21
21 students have both a dog and a cat as pets.