One test case is failing due to runtime error, rest all are pass

Hi team,

             not able to figure out why the code is causing a runtime error. all test cases are succeeded except one.

#include
using namespace std;
int main()
{
long int n;
cin>>n;
if(n>1000000000 || n<3)
{
return -1;
}
else if (n%2==1)
{
cout<<((nn)/2)<<" "<<(((nn)/2)+1)<<endl;
}
else if(n%2==0)
{
cout<<(((n/2)(n/2))-1)<<" "<<(((n/2)(n/2))+1)<<endl;
}
return 0;
}

Hey @Mahesh
Please share your code in Coding blocks ide

code saved in the IDE 343736

Bey @Mahesh
Error is on line 9
You have to print -1 and return 0

thank you. it worked fine.

1 Like