Let x be the number of students who rented for $3 and y the number of students who rented for $5.
x+y=22 (because there were 22 students)
3x+5y=96 (rental cost)
Multiply the first equations by -3:
-3x-3y=-66 and add to the second equation: 2y=30, y=30/2=15 so x=22-15=7.
7 students used the $3 rental and 15 used the $5 rental.