![Program Program](/uploads/1/2/5/6/125640609/872084059.jpg)
Write a program that validates a right triangle. Your program should prompt and read three edges representing a right triangle and determine whether the input is valid. The input is valid only they adhere to the pythagorean theorem. Don't forget to validate each edge. Use the following input for your program.
So the aim is to find the number of solutions which satisfy equations a + b + c = p and a 2 + b 2 = c 2. A naive approach is to run two loops for a(1 to p/2) and b(a+1 to p/3) then make c=p-a-b and increase count by one if. This will take time. An efficient approach can be found by little algebraic manipulation: Since a + c b or, p – b b or, b.