![]() |
VOOZH | about |
Given four positive integers A, B, C, and D representing the length of sides of a Cyclic Quadrilateral, the task is to find the area of the Cyclic Quadrilateral.
Examples:
Input: A = 10, B = 15, C = 20, D = 25
Output: 273.861Input: A = 10, B = 30, C = 50, D = 20
Output: 443.706
Approach: The given problem can be solved based on the following observations:
where, A, B, C, and D are the sides of the triangle and
? and ? are the opposite angles of the quadrilateral.Since, the sum of opposite angles of the quadrilateral is 180 degree. Therefore, the value of cos(180/2) = cos(90) = 0.
Therefore, the formula for finding the area reduces to .
Therefore, the idea is to print the value of as the resultant area of the given quadrilateral.
Below is the implementation of the above approach:
273.861
Time Complexity: O(1)
Auxiliary Space: O(1)