Area of a triangle inscribed in a rectangle which is inscribed in an ellipse | Java Program to find the area of the triangle inscribed within the rectangle which in turn is inscribed in an ellipse ; Function to find the area of the triangle ; length of a and b cannot be negative ; area of the triangle ; Driver code
import java . io . * ; class GFG { static float area ( float a , float b ) { if ( a < 0 b < 0 ) return - 1 ; float A = a * b ; return A ; } public static void main ( String [ ] args ) { float a = 5 , b = 2 ; System . out . println ( area ( a , b ) ) ; } }