With 13 legs he can make 3 desks because 3×4=12 (one leg spare);
With 9 planks he can make 4 desks (one plank spare);
With 22 nails he can make 4 desks (two nails spare).
The maximum number of desks is 3 because he hasn’t enough legs to make more desks.
(He would use 12/13 legs, 6/9 planks and 15/22 nails.)