Set it up this way:

Let the number of students be x
let the number of rows be y
then the number of students per row is x/y

This results in 2 equations from your data:

(x/y+1)(y-2) = x and
(x/y-1)(y+3 = x

Solve these two, gets a bit messy at first but it breaks down very nicely.

(I got x=60, y = 12)

Students of a class are to stand in rows.If one student is extra in a row,there would be 2 rows less.If one student is less in a row,there would be 3 rows more.Find the number of students in the class.Pls answer to this question with the required steps.