Area of the Largest square that can be inscribed in an ellipse | Function to find the area of the square ; a and b cannot be negative ; area of the square ; Driver code
function squarearea ( a , b ) { if ( a < 0 b < 0 ) return - 1 ; var area = 4 * ( ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) ) / ( Math . pow ( a , 2 ) * Math . pow ( b , 2 ) ) ) ; return area ; } var a = 4 , b = 2 ; document . write ( squarearea ( a , b ) ) ;