Largest trapezoid that can be inscribed in a semicircle | Java Program to find the biggest trapezoid which can be inscribed within the semicircle ; Function to find the area of the biggest trapezoid ; the radius cannot be negative ; area of the trapezoid ; Driver code
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static float trapezoidarea ( float r ) { if ( r < 0 ) return - 1 ; float a = ( 3 * ( float ) Math . sqrt ( 3 ) * ( float ) Math . pow ( r , 2 ) ) / 4 ; return a ; } public static void main ( String args [ ] ) { float r = 5 ; System . out . printf ( " % .3f " , trapezoidarea ( r ) ) ; } }