Why this code shows that did you account for negative values?

#include
using namespace std ;
void pythagorusTriplet(int n)
{
int temp1=0 , temp2=0;
if(n%2!=0)
{
temp1 = (nn/2);
cout<<temp1<<" ";
temp2 = ((n
n/2)+1);
cout<<temp2<<" β€œ;
cout<<endl;
}
else
{
temp1 = ((nn/4)-1);
cout<<temp1<<" ";
temp2 = ((n
n/4)+1);
cout<<temp2<<” ";
cout<<endl;
}
}
int main()
{
int n;
cin>>n;
pythagorusTriplet(n);
return 0;
}

hi @deepshreyamishra301_1918130c8477386b

  1. use long long
  2. -1 conditions

here’s the updated code https://ide.codingblocks.com/s/659703 (commented)

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.