Area of largest triangle that can be inscribed within a rectangle | C ++ Program to find the biggest triangle which can be inscribed within the rectangle ; Function to find the area of the triangle ; a and b cannot be negative ; area of the triangle ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float trianglearea ( float l , float b ) { if ( l < 0 b < 0 ) return -1 ; float area = ( l * b ) / 2 ; return area ; } int main ( ) { float l = 5 , b = 4 ; cout << trianglearea ( l , b ) << endl ; return 0 ; }