Given here are n squares which touch each other externally, and are lined up in a row. The distance between the centers of the first and last square is given. The squares have equal side length. The task is to find the side of each square.
Input: d = 42, n = 4 Output: The side of each square is 14 Input: d = 36, n = 5 Output: The side of each square is 9
Suppose there are n squares each having side of length a.
Let, the distance between the first and last squares = d
From the figure, it is clear,
a/2 + a/2 + (n-2)*a = d
a + na – 2a = d
na – a = d
so, a = d/(n-1)
The side of each square is 14
- Find the radii of the circles which are lined in a row, and distance between the centers of first and last circle is given
- Find the side of the squares which are inclined diagonally and lined in a row
- Find the Side of the smallest Square that can contain given 4 Big Squares
- Program to find the side of the Octagon inscribed within the square
- Find the number of squares inside the given square grid
- Distance between centers of two intersecting circles if the radii and common chord length is given
- Count squares with odd side length in Chessboard
- Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles
- Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles
- Number of squares of side length required to cover an N*M rectangle
- Square pyramidal number (Sum of Squares)
- Closest perfect square and its distance
- Program to find third side of triangle using law of cosines
- Find coordinates of the triangle given midpoint of each side
- Find a point that lies inside exactly K given squares
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.