Challenges fundamental

in challenges-fundamental,Pythagoras triplet question i am not able to solve the the case where n=2.
https://ide.codingblocks.com/s/47445

Hey Aastha, the formula you are using x=n+1 and y=n+1 may be it is working for some random case but it will not work for all the test cases. You can use loop method but that will result in a TLE as n can have a larger value. So, try to think a lil bit more you will get 2 different formulas for pythagoras triplets, one is for when n is odd and another one when n is even.
If still you are not able to get the formulas, do reply here… i will help you with formulas also.

Hope this helps you :slight_smile:

thank you. It worked.