在Java中找到一个内切于正方形的圆的面积

在Java中找到一个内切于正方形的圆的面积

A circle is a round shape two-dimensional diagram which has no corners. Every circle has an origin point and every point on the circle maintains equal distance from the origin. The distance between the origin and a point in a circle is known as Radius of the circle. And similarly, if we draw a line from one edge to another edge of the circle and the origin is held in the middle of it, that line is known as diameter of the circle. Basically, the diameter is double of the length of the radius.

A square consists of four sides and all the four sides have equal length. If we try to put a circle inside a square with maximum radius possible, then the diameter of the circle is equal to the length of the side of the square. So here we can conclude that the radius of the circle is equal to half of the square’s side length.

Area of the circle refers to the total surface area acquired by the circle. We can calculate the square of the circle by using radius and a constant known as π

Formula to calculate area of the circle −

$$mathrm{面积=pi times (半径)^{2}}$$

由于圆被内接在一个正方形中,所以圆的半径(r)= 边长/2,其中‘边长’指的是正方形的边长。

$$mathrm{Area ;of ; inscribed ;circle ;in ;square=varpitimes(side/2)^{2}=varpitimes(side^{2}/4)=(varpi/4)^{*}sides^{2}}$$

在本文中,我们将看到如何找到内接在正方形中的圆的面积

using Java.

To show you some instances −

Instance-1

The side length of the square given = 9 The area of the circle inscribed in square = (ϖ / 4) * side2 = (3.141/4) * 9 * 9 = 63.605 登录后复制