text: Check if right triangle possible from given area and hypotenuse | C # program to check existence of right triangle . ; Prints three sides of a right triangle from given area and hypotenuse if triangle is possible , else prints - 1. ; Descriminant of the equation ; applying the linear equation formula to find both the roots ; Driver code
code: using System ; class GFG { static void findRightAngle ( double A , double H ) { double D = Math . Pow ( H , 4 ) - 16 * A * A ; if ( D >= 0 ) { double root1 = ( H * H + Math . Sqrt ( D ) ) / 2 ; double root2 = ( H * H - Math . Sqrt ( D ) ) / 2 ; double a = Math . Sqrt ( root1 ) ; double b = Math . Sqrt ( root2 ) ; if ( b >= a ) Console . WriteLine ( a + " ▁ " + b + " ▁ " + H ) ; else Console . WriteLine ( b + " ▁ " + a + " ▁ " + H ) ; } else Console . WriteLine ( " - 1" ) ; } public static void Main ( ) { findRightAngle ( 6 , 5 ) ; } }