Largest triangle that can be inscribed in a semicircle | C ++ 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; float trianglearea ( float r ) { if ( r < 0 ) return -1 ; return r * r ; } int main ( ) { float r = 5 ; cout << trianglearea ( r ) << endl ; return 0 ; }