Solution :
Let students in each row be x.
And Let number of rows be y.
then, total number of students = xy
Case 1 : When 3 students are extra in a row, then number of rows becomes (y – 1)
xy = (x + 3)(y – 1)
\(\implies\) x – 3y + 3 = 0 …….(1)
Case 2 : When 3 students are less in the row, then the number of rows becomes (y + 2)
xy = (x – 3)(y + 2)
\(\implies\) 2x – 3y – 6 = 0 ……..(2)
Solving equation (1) and (2), we get
x = 9, y = 4
Hence, the number of students is 36.