My code fails 2 out of 5 test cases. Can't download test cases. I have used a different approach than the solution. Please help me resolve it

// assumes n,root and n+i as pythagoras triplets where root=sqrt((n+i)^2-n^2) i.e root=sqrt(i*(2*n+ i)). Passes first 3 out 5 test cases
#include
#include<math.h>
using namespace std;
int main() {
unsigned int n;
cin>>n;

int i;
double root;
if(n>2){
for(i=1;i<=(pow(2,32)-1);i++){
    root= sqrt(i*(2*n+ i));
    if(!(root-int(root))){  //checks if root is an integer
        break;
    }
}
cout<<root<<" "<<n+i<<endl;
}
else
cout<<-1;
return 0;

}

Plz send your code by saving on ide so that I can check for error in your code

Thanks

Your code fails in following types of test cases,
for eg, when n=24,
Expected output : 143 145
Your output : 7 25

It is mention in the question that you have to print pythagoras triplet in increasing order only, so if N=24, you can have a triplet less than 24, rather you have to take triplets greater than it…