Area of largest isosceles triangle that can be inscribed in an Ellipse whose vertex coincides with one extremity of the major axis | Java program for the above approach ; Function to calculate area of the isosceles triangle ; If a and b are negative ; Stores the area of the triangle ; Print the area ; Driver Code ; Given value of a & b ; Function call to find the area of the isosceles triangle
import java . util . * ; class GFG { static void triangleArea ( float a , float b ) { if ( a < 0 b < 0 ) { System . out . println ( - 1 ) ; return ; } float area = ( 3 * ( float ) Math . sqrt ( 3 ) * a * b ) / ( 4 ) ; System . out . println ( area ) ; } public static void main ( String [ ] args ) { float a = 1 , b = 2 ; triangleArea ( a , b ) ; } }