I tried calculating the pythagorean pair by using (2m, m^2-1,m^2+1) where m is always an integer. I equate the given number with (2m , m^2-1,m^2+1) by hit and trial method and m comes out to be integer I simultaneously calculated the pair. But I could not get where I am going wrong.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int N,m;
cin>>N;
float a=sqrt(N+1);
float b =sqrt(N-1);
if(N==1||N==2)
{
cout<<-1;
}
else if(N%2==0)
{
m = N/2;
cout<<(mm)-1<<" "<<(mm)+1;
}
else if(ceil(a)==floor(a))
{
cout<<(2a)<<" "<<(aa)+1;
}
else if(ceil(b)==floor(b))
{
cout<<2b<<" "<<(bb)-1;
}
else cout<< -1;
}