#include
using namespace std ;
void pythagorusTriplet(int n)
{
int temp1=0 , temp2=0;
if(n%2!=0)
{
temp1 = (nn/2);
cout<<temp1<<" ";
temp2 = ((nn/2)+1);
cout<<temp2<<" β;
cout<<endl;
}
else
{
temp1 = ((nn/4)-1);
cout<<temp1<<" ";
temp2 = ((nn/4)+1);
cout<<temp2<<β ";
cout<<endl;
}
}
int main()
{
int n;
cin>>n;
pythagorusTriplet(n);
return 0;
}
Why this code shows that did you account for negative values?
hi @deepshreyamishra301_1918130c8477386b
- use long long
- -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.