#include <stdio.h>
int main()
{
int x;
printf("\n ENTER THE NUMBER:");
scanf("%d", &x);
if(x > 0)
printf("x is positive \n");
else if(x == 0)
printf("x is zero \n");
else
printf("x is negative \n");
getch();
return 0;
}
<b>Output 1:</b>
ENTER THE NUMBER:12
x is positive
<b>Output 2</b>
ENTER THE NUMBER:0
x is zero
<b>Output 3</b>
ENTER THE NUMBER:-12
x is negative
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.