Pythagoras triplet(failing 3 test cases)

include<bits/stdc++.h>

using namespace std;

define long long int

in32_t main(){
int n;
cin>>n;

int a,b;
if (n%2 == 0) // if n is even
{
a = (pow(n,2)/4) - 1;
b = (pow(n,2)/4) + 1;
cout<<min(a , b)<<" “<< max(a , b);
}
else if(n%2 != 0){
a = (pow(n,2)-1)/2;
b = (pow(n,2)+1)/2;
cout<<min(a,b)<<” "<<max(a , b);
}

else if(n==1 || n == 0){
cout<<"-1";
}

return 0;

}

@abhinavssr2003_eab0717682969e5c, https://ide.codingblocks.com/s/657506 check the updated code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

What was the mistake in my code

@abhinavssr2003_eab0717682969e5c, it your code only , removed power function and took the check above bcoz u r checking for n==1 which is odd so it will go in second condition also for 2 no such triplet is possible but it will go in condition 1 these were the mistakes

ohh yeah i messed up the loops…thanks