The concept to do this question is to break the number into its factors and then make different combination.
The given number has just two factors
The factors of 21 are 3 & 7.
Which means
21 = 3 × 7.
So
Either we can have 7 shelves with 3 mugs on each shelf.
Or
We can have 3 shelves with 7 mugs on each shelf.
This way as 21 is divisible by 3 & 7. No mugs shall be left out.
So We have two solutions to this.
7 shelves with 3 mugs on each shelf.
3 shelves with 7 mugs on each shelf.