Find other two sides of a right angle triangle | Finds two sides of a right angle triangle if it they exist . ; if n is odd ; case of n = 1 handled separately ; case of n = 2 handled separately ; Driver Code
< ? php function printOtherSides ( $ n ) { if ( $ n & 1 ) { if ( $ n == 1 ) echo - 1 ; else { $ b = ( $ n * $ n - 1 ) / 2 ; $ c = ( $ n * $ n + 1 ) / 2 ; echo " b ▁ = ▁ " , $ b , " , ▁ c ▁ = ▁ " , $ c ; } } else { if ( $ n == 2 ) echo - 1 ; else { $ b = $ n * $ n / 4 - 1 ; $ c = $ n * $ n / 4 + 1 ; echo " b ▁ = ▁ " , $ b , " , ▁ c ▁ = ▁ " , $ c ; } } } $ a = 3 ; printOtherSides ( $ a ) ; return 0 ; ? >