Let assume he had x toys and bought it for Rs.y per piece.
Now, we can form these two equations from these
x*y = 900;//Total cost
(y+2)(x-5) = 900+80; //as he mad profit of Rs.80 by selling x-5 toys in Rs.(y+2).
On solving the above two equation we will get x=75 and y=12
Number of toys = 75
Initial Cost = 12