I did solve the problem but if i put 12, my answer is 35 and 37 and there is another solution which is 5 and 13… Both of them are correct.
#include
#include
using namespace std;
int main() {
int m,n,num,temp,temp1,temp2,temp3,a;
cin >> num;
if(num%2==0){
m=num/2;
n=1;
temp=pow(m,2)-pow(n,2);
temp1=pow(m,2)+pow(n,2);
}
if (num%2!=0){
m=(num+1)/2;
n=(num-1)/2;
temp=2*m*n;
temp1=pow(m,2)+pow(n,2);
}
temp2=pow(temp,2)+pow(num,2);
if(pow(temp1,2)==temp2){
cout << temp << " " << temp1;
}
else{
cout << "-1";
}
}