Length of Diagonals of a Cyclic Quadrilateral using the length of Sides . | Java Program to implement the above approach ; Function to calculate the length of diagonals of a cyclic quadrilateral ; Driver Code ; Function Call ; Print the final answer
import java . util . * ; class GFG { static Vector < Float > Diagonals ( int a , int b , int c , int d ) { Vector < Float > ans = new Vector < Float > ( ) ; ans . add ( ( float ) Math . sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * d ) + ( b * c ) ) / ( ( a * b ) + ( c * d ) ) ) ) ; ans . add ( ( float ) Math . sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * b ) + ( c * d ) ) / ( ( a * d ) + ( b * c ) ) ) ) ; return ans ; } public static void main ( String [ ] args ) { int A = 10 ; int B = 15 ; int C = 20 ; int D = 25 ; Vector < Float > ans = Diagonals ( A , B , C , D ) ; System . out . printf ( " % .2f ▁ % .2f " , ( ans . get ( 0 ) ) + .01 , ans . get ( 1 ) + .01 ) ; } }