Pythagoras Triplet code

one test case - timelimit
second test case - wrong ans

https://ide.codingblocks.com/s/62092

Hey Piyush, you don’t have to find the numbers using loop. this will give timelimit error for large numbers. you have to use a formula for finding triplets. which is there in general.
Pythagoras Theorem can also be written as c^2 - b^2 = a^2
i.e aa = (c-b)(c+b)
a
a x 1 = a*a, thus c = (a^2+1)/2 and b = (a^2 - 1)/2, this solution works if n is odd.
For even solution, c+b = n^2/2, c-b=2, thus, we get the above formula when n is even.