D
D
Dmitry_Sel2021-11-23 17:35:57
Algorithms
Dmitry_Sel, 2021-11-23 17:35:57

How to find the perimeter of a circle inscribed in a square using a for loop?

Knowing the length of the side of the square 78 and the radius of the inscribed circle 39, you need to use the for loop to calculate how many points fall within the radius of the circle, thereby finding out its perimeter. Understanding how to do it does not come at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmshar, 2021-11-23
@Dmitry_Sel

After a discussion in the comments (6084 points on the perimeter of the square and you need to understand how many of them are included in the circle) (however, I still don’t understand where the “perimeter of the square” is) the task comes down to a simple check

distance from the point to the center of the shape <= radius of the circle.

The radius of the circle is given explicitly.
Distance - a simple Euclidean two-dimensional distance (square root of the sum of the squared distances for each of the two coordinates)
In the loop, check each point and count how many of them meet the specified condition.
Finding out the perimeter is actually from another opera.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question