Area Of Square Inside Circle
Area of foursquare Confining by Circle
Given the radius(r) of circle then discover the area of square which is Confining by circle.
Examples:
Input : r = 3 Output :Area of square = xviii Input :r = vi Output :Area of foursquare = 72
All iv sides of a square are of equal length and all iv angles are xc caste. The circle is circumscribed on a given square shown by a shaded region in the below diagram.
Properties of Circumscribed circumvolve are equally follows:
- The eye of the circumcircle is the point where the two diagonals of a square encounter.
- Circumscribed circle of a square is made through the four vertices of a foursquare.
- The radius of a circumcircle of a foursquare is equal to the radius of a square.
Formula used to calculate the area of circumscribed square is:
ii * r2
where, r is the radius of the circle in which a foursquare is circumscribed by circle.
How does this formula work?
Assume diagonal of square is d and length of side is a.
We know from the Pythagoras Theorem, the diagonal of a
foursquare is √(two) times the length of a side.
i.east d2 = a2 + a2
d = 2 * atwo
d = √(ii) * a
At present,
a = d / √2
and Nosotros know diagonal of foursquare that are Circumscribed by
Circle is equal to Bore of circle.
so Area of square = a * a
= d / √(two) * d / √(2)
= d2/ 2
= ( 2 * r )2/ ii ( We know d = two * r )
= 2 * rii
CPP
#include <iostream>
using
namespace
std;
int
find_Area(
int
r)
{
return
(2 * r * r);
}
int
main()
{
int
r = iii;
cout <<
" Surface area of foursquare = "
<< find_Area(r);
return
0;
}
Java
class
GFG {
static
int
find_Area(
int
r)
{
return
(
2
* r * r);
}
public
static
void
main(String[] args)
{
int
r =
3
;
System.out.print(
" Expanse of foursquare = "
+ find_Area(r));
}
}
Python3
def
find_Area(r):
render
(
2
*
r
*
r)
r
=
three
impress
(
" Area of foursquare = "
, find_Area(r))
C#
using
System;
class
GFG {
static
int
find_Area(
int
r)
{
return
(ii * r * r);
}
public
static
void
Primary()
{
int
r = 3;
Console.WriteLine(
" Expanse of foursquare = "
+ find_Area(r));
}
}
PHP
<?php
role
find_Area(
$r
)
{
return
(2 *
$r
*
$r
);
}
$r
= 3;
echo
(
"Area of foursquare = "
);
echo
(find_Area(
$r
));
?>
Javascript
<script>
function
find_Area(r)
{
return
(ii * r * r);
}
let r = 3;
document.write(
" Area of square = "
+ find_Area(r));
</script>
Output:
Expanse of foursquare = 18
Time Complication: O(1)
Auxiliary Space: O(ane)
Please advise if someone has a better solution which is more than efficient in terms of space and time.
This article is contributed by Aarti_Rathi. Please write comments if you detect anything incorrect, or you want to share more than information almost the topic discussed above
Area Of Square Inside Circle,
Source: https://www.geeksforgeeks.org/area-square-circumscribed-circle/
Posted by: leechtwout1972.blogspot.com
0 Response to "Area Of Square Inside Circle"
Post a Comment