Program to find the Radius of the incircle of the triangle | Function to find the radius of the incircle ; the sides cannot be negative ; semi - perimeter of the circle ; area of the triangle ; Radius of the incircle ; Return the radius ; Get the sides of the triangle ; Find the radius of the incircle
< ? php function findRadiusOfIncircle ( $ a , $ b , $ c ) { if ( $ a < 0 $ b < 0 $ c < 0 ) return -1 ; $ p = ( $ a + $ b + $ c ) / 2 ; $ area = sqrt ( $ p * ( $ p - $ a ) * ( $ p - $ b ) * ( $ p - $ c ) ) ; $ radius = $ area / $ p ; return $ radius ; } $ a = 2 ; $ b = 2 ; $ c = 3 ; echo findRadiusOfIncircle ( $ a , $ b , $ c ) . " " ;