Here is my code for Pythagorean triplets:
#include
using namespace std;
int main() {
int num;
cin>>num;
if (num%2 == 0) {
int n = num/2;
int m = 1;
int p = nn - 1;
int h = nn + 1;
if (p>0) {
cout<<p<<" “<<h<<endl;
}
else {
cout<<”-1";
}
}
else {
int m = (num+1)/2;
int n = (num-1)/2;
int p = 2mn;
int h = nn + mm;
if (p>0) {
cout<<p<<" “<<h<<endl;
}
else {
cout<<”-1";
}
}
return 0;
}
2 test cases are wrong. Please tell me what am i doing wrong?