Pythagoras triplet approach

how to approach this question??

Hii Himanshu,
See if the given no. is less than 3 than it is not possible to form a Pythagoras triplet. Also if the no. is not divisible by 2 then the other two no. can be get by the formulas (n^2 -1)/2 & (n^2 +1)/2. If the no. is divisible by 2 then we can get the other two no. by the formulas (n^2/4 - 1) & (n^2/4 +1)

thank u sanyam for ur help now my code is working perfectly fine but 2 of the testcases are still showing error.https://ide.codingblocks.com/s/63195

Hii Himanshu,
n should be long type not int type due to constraint n <= 10^9. I have made changes to your code and you can see them on below link:
https://ide.codingblocks.com/s/63304

still last two cases are showing wrong answer.