"The area of your square garden is 100 square yards" means that the garden is 10 yd by 10 yd.
Calculate: √(100 sq yd) = 10 yd
There is a post at each corner and then evenly spaced posts on each side. Now, be careful, the centers of the fence posts are 6 ft apart, which is 2 yd. [note: you could either use 6 feet and 30 feet on each side of the garden or you can use 2 yd and 10 yd on each side of the garden.]
There is a Cornerpost [1]. Then (10/2)=5 posts complete the first side. Again, 5 posts complete the second side and another 5 posts for the third side. On the last side, only 4 posts are needed since the Cornerpost has already been set. That is 1+5+5+5+4=20 posts. If the perimeter were in a straight line, this would be a post at the start, another post every 2 yd to get to 40 yd (that's 20 posts), but no post at the end (because the perimeter of your yard already has a Cornerpost).