Few inferences from the question
1) The number of students in Class A are in multiples of 5
2) The number of students in Class B are in multiples of 3
The combined total of students from both the class is 45.
Therefore the possible combination of students, with above points
Class A = 15 | Class B = 30
Class A = 30 | Class B = 15
It is give that 1 out of 5 students in class A agreed to go, so 4 out of 5 students
did not agree to go
Also,
2 out of 3 students in class B agreed to go, so 1 out of 3 students
did not agree to go
Class A = 15 | Class B = 30Number of students in class A who did not agree to go = \(\frac{4}{5} * 15\) = 12
Number of students in class B who did not agree to go = \(\frac{1}{3} * 30\) = 10
Total = 22
Class A = 30 | Class B = 15Number of students in class A who did not agree to go = \(\frac{4}{5} * 30\) = 24
Number of students in class B who did not agree to go = \(\frac{1}{3} * 15\) = 5
Total = 29
We want the minimum number , hence IMO
Option D