a. Let the number of students = n
Number of sweets given to one student = \(\frac{180}{n}\)
Since 9 students were absent = \(\frac{180}{n-9}\)
∴ \(\frac{180}{n-9}=\frac{180}{n}+1\)
180n = 180(n - 9) + n(n - 9)
180n - 180n + 1620 - n2 + 9n = 0
n2 - 9n - 1620 = 0
\(n=\frac{9\pm \sqrt{81+4\times1620}}{2}\) = \(\frac{9\pm81}{2}\) or \(\frac{9-18}{2}\)
= 45 or -36
∴ Total number of students = 45
b. Total present = 45 – 9 = 36