Answer:
if (userNum > 0)
{
printf("Positive.\n");
}
else
{ printf("Non-positive, converting to 1.\n");
userNum = 1;
printf("Final: %d\n", userNum);
}
Explanation:
Paranthesis was missing in the mentioned code. If else statement always nest inside paranthesis in C language. Please note that the above code will also convert not only negative numbers but also 0 to 1!