Largest rectangle that can be inscribed in a semicircle | Java Program to find the the biggest rectangle which can be inscribed within the semicircle ; Function to find the area of the biggest rectangle ; the radius cannot be negative ; area of the rectangle ; Driver code
class GFG { static float rectanglearea ( float r ) { if ( r < 0 ) return - 1 ; float a = r * r ; return a ; } public static void main ( String [ ] args ) { float r = 5 ; System . out . println ( ( int ) rectanglearea ( r ) ) ; } }