Length of Diagonals of a Cyclic Quadrilateral using the length of Sides . | Function to calculate the length of diagonals of a cyclic quadrilateral ; Driver Code ; Function Call ; Print the final answer
function Diagonals ( a , b , c , d ) { var p = parseFloat ( Math . sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * d ) + ( b * c ) ) / ( ( a * b ) + ( c * d ) ) ) ) ; var q = parseFloat ( Math . sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * b ) + ( c * d ) ) / ( ( a * d ) + ( b * c ) ) ) ) ; return [ p , q ] ; } var A = 10 ; var B = 15 ; var C = 20 ; var D = 25 ; var ans = Diagonals ( A , B , C , D ) document . write ( ans [ 0 ] . toFixed ( 2 ) + " " , ans [ 1 ] . toFixed ( 2 ) ) ;