One test case is failing , why?

#include
using namespace std;

void pythogtriplet(long long int n){
if(n==1||n==2){
cout<<’-1’;
}
else if(n%2==0){
long long int var = n * n / 4;
cout<<var - 1<<" “<< var + 1;
}
else if(n%2!=0){
long long int var = n * n +1;
cout<<var/2 - 1<<” "<<var/2;
}
}

int main() {
long long int n;
cin>>n;
if(n>2){
pythogtriplet(n);
}
else{
cout<<’-1’;
}

return 0;

}

hey @Bond007 your answer is wrong for cases when n is odd, If n is odd the two solutions are (nn - 1)/2 and
(n
n + 1)/2. here is your code after rectifications

no bro , for n also the condition what i have written is correct. the thing is i am printing string ‘-1’ instead of -1. any ways thank you for the reply

@Bond007, it is possible that what i am suggesting might be simplification of what you’d written, i am sorry for misinforming you.

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.