Altitude of largest Triangle that can be inscribed in a Rectangle | C ++ program for the above approach ; Function to find the greatest altitude of the largest triangle triangle that can be inscribed in the rectangle ; If L is greater than B ; Stores the maximum altitude value ; Return res ; Driver Code ; Given Input ; Function call
import java . io . * ; class GFG { static int largestAltitude ( int L , int B ) { if ( L > B ) { int t = L ; L = B ; B = t ; } int res = Math . min ( B / 2 , L ) ; return res ; } public static void main ( String [ ] args ) { int L = 3 ; int B = 4 ; System . out . print ( largestAltitude ( L , B ) ) ; } }