What is the error in my code

#include
using namespace std;
int main() {
long long int num, m, n;
cin>>num;
if (num % 2){
m = (num + 1) / 2;
n = (num - 1) / 2;
cout<< 2 * m * n<<" “<< m * m + n * n;
}
else if (num <= 2)
cout<<-1;
else{
m = num / 2;
n = 1;
cout << m m - nn<<” "<< m m + nn;
}
return 0;
}

@coe17b030
Put num <=2 condition before num % 2 condition
if (num <= 2)
cout << -1;
else if ( num % 2 )
.
.

Otherwise your code would fail for inputs like 0 and 2.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.