Area of a circle inscribed in a rectangle which is inscribed in a semicircle | Java Program to find the area of the circle inscribed within the rectangle which in turn is inscribed in a semicircle ; Function to find the area of the circle ; radius cannot be negative ; area of the circle ; Driver code
import java . io . * ; class GFG { static float area ( float r ) { if ( r < 0 ) return - 1 ; float area = ( float ) ( 3.14 * Math . pow ( r / ( 2 * Math . sqrt ( 2 ) ) , 2 ) ) ; return area ; } public static void main ( String [ ] args ) { float a = 5 ; System . out . println ( area ( a ) ) ; } }