Dadas dos bases del trapezoide isósceles ABCD como a y b , la tarea es encontrar el área del círculo inscrito en este trapecio
Ejemplos:
Input: a = 10, b = 30 Output: Area = 235.57 Input: a = 20, b = 36 Output: Area = 565.38
Derivación: Dado un círculo inscrito en el trapecio ABCD (lados AB = n y CD = m), necesitamos encontrar la altura del trapecio, es decir, (AL), que es la mitad del radio del círculo para encontrar el área de el círculo.
Para encontrar la altura del círculo hacemos la siguiente operación.
- El círculo siempre tocará los lados del trapecio en sus puntos medios. Di que los puntos medios de AB, BD, CD, AC son G, F, H, E, y únelos con el centro del círculo.
- Ahora desde Symmetry, podemos ver que
AG = AE = n/2, EC = CG = m/2, HD = DF = n/2, GB = FB = m/2
- Ahora en el Triángulo ACL aplicamos el teorema de Pitágoras .
Hypotenuse AC = m/2 + n/2 Base CL = CH - AG = m/2 - n/2 we get Perpendicular AL = Square_root(m * n)
- Por lo tanto la altura del trapecio = AL = Square_Root(Producto de los lados dados)
- Ahora, el radio del círculo es simplemente la mitad de la altura y, por lo tanto, el área se puede calcular fácilmente.
Acercarse:
- Encuentra la altura del trapezoide como (square_root(m * n)) .
- Hallar el radio de la circunferencia inscrita
R = height / 2 = square_root(m * n) / 2
- ahora encuentra el area del circulo
= Pi * R2 = ( 3.141 * m * n ) / 4
A continuación se muestra la implementación del enfoque anterior:
C++
// CPP implementation to find // the area of the circle // inscribed in a trapezoid // having non- parallel sides m, n #include<bits/stdc++.h> using namespace std; // Function to find area of circle // inscribed in a trapezoid // having non- parallel sides m, n double area_of_circle(int m, int n) { // radius of circle by the // formula i.e. root( m * n) / 2 // area of circle = (3.141 ) * ( R ** 2 ) int square_of_radius = ( m * n ) / 4; double area = ( 3.141 * square_of_radius ); return area; } // Driver Code int main(){ int n = 10; int m = 30; cout << (area_of_circle(m, n)); } // This code is contributed by mohit kumar 29
Java
// Java Program to find // the area of the circle // inscribed in a trapezoid // having non- parallel sides m, n class GFG { // Function to find area of circle // inscribed in a trapezoid // having non- parallel sides m, n static double area_of_circle(int m, int n) { // radius of circle by the // formula i.e. root( m * n) / 2 // area of circle = (3.141 ) * ( R ** 2 ) int square_of_radius = ( m * n ) / 4; double area = ( 3.141 * square_of_radius ); return area; } // Driver code public static void main (String[] args) { int n = 10; int m = 30; System.out.println(area_of_circle(m, n)); } } // This code is contributed by Yash_R
Python3
# Python 3 implementation to find # the area of the circle # inscribed in a trapezoid # having non- parallel sides m, n # Function to find area of circle # inscribed in a trapezoid # having non- parallel sides m, n def area_of_circle(m, n): # radius of circle by the # formula i.e. root( m * n) / 2 # area of circle = (3.141 ) * ( R ** 2 ) square_of_radius = ( m * n ) / 4 area = ( 3.141 * square_of_radius ) return area # Driver Code if __name__=='__main__': n = 10 m = 30 print(area_of_circle(m, n))
C#
// C# Program to find // the area of the circle // inscribed in a trapezoid // having non- parallel sides m, n using System; class GFG { // Function to find area of circle // inscribed in a trapezoid // having non- parallel sides m, n static double area_of_circle(int m, int n) { // radius of circle by the // formula i.e. root( m * n) / 2 // area of circle = (3.141 ) * ( R ** 2 ) int square_of_radius = ( m * n ) / 4; double area = ( 3.141 * square_of_radius ); return area; } // Driver code public static void Main () { int n = 10; int m = 30; Console.WriteLine(area_of_circle(m, n)); } } // This code is contributed by Sanjit_Prasad
Javascript
<script> // Javascript Program to find // the area of the circle // inscribed in a trapezoid // having non- parallel sides m, n // Function to find area of circle // inscribed in a trapezoid // having non- parallel sides m, n function area_of_circle(m, n) { // Radius of circle by the // formula i.e. root( m * n) / 2 // area of circle = (3.141 ) * ( R ** 2 ) var square_of_radius = ( m * n ) / 4; var area = ( 3.141 * square_of_radius ); return area; } // Driver Code var n = 10; var m = 30; document.write(area_of_circle(m, n)); // This code is contributed by Khushboogoyal499 </script>
Producción:
235.575
Complejidad del tiempo: O(1)
complejidad del espacio: O(1)
Publicación traducida automáticamente
Artículo escrito por virusbuddha y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA