Area of Circumcircle and Incircle of a Right Kite
Last Updated :
31 Jul, 2022
Given two positive integers A and B representing the sides of the right kite, the task is to find the area of the circumcircle and incircle of a right kite.
A right kite is a kite that can be inscribed in a circle with two opposite angles are at right angles. The line of symmetry of the kite is also the diameter of the circumcircle of the kite. It divides the kite into two congruent right-angled triangles having sides as A and B of a right kite.
Examples:
Input: A = 3, B = 4
Output: Area of circumcircle of Right Kite is 19.625, Area of incircle of Right Kite is 3.14
Input: A = 10, B = 5
Output: Area of circumcircle of Right Kite is 98.125, Area of incircle of Right Kite is 28.26
Approach: There are some observations to solve this problem. Follow the steps below to solve this problem:
- Here, a = AB = AD and b = BC = CD
- In the kite ABCD with opposite angles B and D as 90°, thus the opposite angles can be calculated as tan (A/2) = b/a and tan(C/2) = a/b
- Let p as the length of diagonal AC and q as the length of diagonal BD.
- Diagonal AC can be easily calculated using the Pythagoras Theorem. Hence p = (a2 + b2)½
- Since the diagonal is equal to the diameter of the circumcircle of the kite, the radius of the circumcircle is calculated as R = (a2 + b2)½/2
- Thus, the area of the circumcircle will be pi * R* R
- Also, all kites are tangential quadrilaterals, therefore the radius of the incircle can be calculated by r = Area of kite/Semiperimeter of the kite i.e r = a*b/(a+b).
- Thus, the area of the incircle will be pi*r*r.
Below is the implementation of the above approach:
C++
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14
double AreaOfCircumcircle( int a, int b)
{
double radius = sqrt (a * a + b * b)
/ 2;
return pi * radius * radius;
}
double AreaOfIncircle( int a, int b)
{
double radius = (a * b) / (a + b);
return pi * radius * radius;
}
int main()
{
int a, b;
a = 10;
b = 5;
double circumarea = AreaOfCircumcircle(
a, b);
cout << "Area of circumcircle of Right Kite is"
<< " " << circumarea << endl;
double inarea = AreaOfIncircle(
a, b);
cout << "Area of incircle of Right Kite is"
<< " " << inarea << endl;
return 0;
}
|
Java
public class GFG {
static double pi = 3.14 ;
static double AreaOfCircumcircle( int a, int b)
{
double radius = Math.sqrt(a * a + b * b) / 2 ;
return pi * radius * radius;
}
static double AreaOfIncircle( int a, int b)
{
double radius = (a * b) / (a + b);
return pi * radius * radius;
}
public static void main(String[] args)
{
int a, b;
a = 10 ;
b = 5 ;
double circumarea = AreaOfCircumcircle(a, b);
System.out.printf(
"Area of circumcircle of Right Kite is %.3f\n" ,
circumarea);
double inarea = AreaOfIncircle(a, b);
System.out.printf(
"Area of incircle of Right Kite is %.2f\n" ,
inarea);
}
}
|
Python3
import math
pi = 3.14
def AreaOfCircumcircle(a, b):
radius = math.sqrt(a * a + b * b) / 2
return pi * radius * radius
def AreaOfIncircle( a, b):
radius = (a * b) / / (a + b)
return pi * (radius * * 2 )
a = 10
b = 5
circumarea = AreaOfCircumcircle(a, b)
print ( "Area of circumcircle of Right Kite is" , " " , format (circumarea, ".3f" ))
inarea = AreaOfIncircle(a, b)
print ( "Area of incircle of Right Kite is" , " " , format (inarea, ".2f" ))
|
C#
using System;
class GFG{
static double pi = 3.14;
static double AreaOfCircumcircle( int a, int b)
{
double radius = Math.Sqrt(a * a + b * b) / 2;
return pi * radius * radius;
}
static double AreaOfIncircle( int a, int b)
{
double radius = (a * b) / (a + b);
return pi * radius * radius;
}
public static void Main()
{
int a, b;
a = 10;
b = 5;
double circumarea = AreaOfCircumcircle(a, b);
Console.WriteLine(
"Area of circumcircle of Right Kite is " +
circumarea);
double inarea = AreaOfIncircle(a, b);
Console.WriteLine(
"Area of incircle of Right Kite is " + inarea);
}
}
|
Javascript
<script>
var pi = 3.14
function AreaOfCircumcircle(a, b) {
let radius = Math.sqrt(a * a + b * b)
/ 2;
return pi * radius * radius;
}
function AreaOfIncircle(a, b) {
let radius = (a * b) / (a + b);
return pi * radius * radius;
}
let a, b;
a = 10;
b = 5;
let circumarea = AreaOfCircumcircle(a, b);
document.write( "Area of circumcircle of Right Kite is " +
(circumarea.toFixed(3)) + "<br>" );
let inarea = AreaOfIncircle(
a, b);
document.write( "Area of incircle of Right Kite is " +
(inarea.toFixed(3)) + "<br>" );
</script>
|
Output
Area of circumcircle of Right Kite is 98.125
Area of incircle of Right Kite is 28.26
Time Complexity: O(logn) since using inbuilt sqrt function
Auxiliary Space: O(1)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...