Let the total number of students be x
According to the question,
Number of students dancing =x2
Number of students remaining =x−x2
=x2
Students playing cricket
=(34)(x2)
=3x8
Remaining students =9
⇒ (x−x2)−3x8=9⇒ x8=9⇒ x=8×9⇒ x=72
Hence, the total number of students in the class = 72