Altitude of largest Triangle that can be inscribed in a Rectangle | 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 ; Given Input ; Function call
function largestAltitude ( L , B ) { if ( L > B ) { var t = L ; L = B ; B = t ; } var res = Math . min ( B / 2 , L ) ; return res ; } var L = 3 ; var B = 4 ; document . write ( largestAltitude ( L , B ) ) ;