There is a rectangular table of size 21cm ×15 cm formed by 21 × 15 small squares of side 1cm each. Number of vertices of small squares through which a diagonal of the rectangular table passes is

starting at one corner, if you move over x squares and up y squares, the diagonal passes through the upper-right corner of the square located there is

y/x = 21/15 = 7/5
so, the squares with upper-right corner at (0,0)(5,7),(10,14),(15,21) have their corner on the diagonal.

Since there are two diagonals, that makes 8 such squares.