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