Pythagoras triplet

sir i have got 60/100 points in this question. but it is showing that i have not considered every possible input like i have not considered -ve numbers in my program . it is showing a green tick but not showing success mark there. my program is working well and it is showing correct answers. what should i have done to get 100 points??

should i post my code here ??

hello @pushkar24sharma
pls save ur code here - > https://ide.codingblocks.com/
and share the link with me


@aman212yadav sir is this alright???

for n <= 2 answer will always be -1 .

@aman212yadav sir but it is written in the question that we have to print -1 for those value of n when the pair does not exist. in a triplet having 0 or -ve numbers is of no sense because in a triangle having a side lenght 0 or -ve has no meaning. when we input 2 its Pythagorean triplets are 0, 2, 2. since it has 0 so i printed -1 there. what is wrong with that?

nothing wrong,
just now i checked ur code it is working fine.
if is failing for some test cases because of overflow.

declare n,num1,num2 as long long anf then it should work fine

1 Like

@aman212yadav thank u sir. now it is working and showing accepted.