Please post all cde in [CODE ] blocks, as instructed in the FAQ's.
Code:
#include<stdio.h>
#include<conio.h>
int num,repeat;
main()
{
printf("Enter any number: ");
scanf("%d", &num);
do
{
if(num > 0)
{
printf("Number is POSITIVE");
}
if(num < 0)
{
printf("Number is NEGATIVE");
}
if(num == 0)
{
printf("Number is ZERO");
}
}
while(num=='0');
repeat=1;
getch();
}
First, you should check the result from scanf() to insure that a valid number has been entered.
Next, you are comparing num against the character '0, NOT the VALUE 0 (Zero)
Code:
while(num == 0);
// NOT
while(num == '0');
Also, make your variables local, and always inisitialize them to zero or some other specific value.
Last, please don't use conio.h functions. They are non-standard C and only available in Windows compilers.