//A program to check the number is Positive, Negative or Zero using C program.
#include<stdio.h>#include<conio.h>
void main()
{
int num;
char choice;
do
{
printf("Enter an integer number :");
scanf("%d",&num);
if(num==0)
printf("Number is ZERO.");
else if(num>0)
printf("Number is POSITIVE.");
else
printf("Number is NEGATIVE.");
printf("\n\nWant to check again (press Y/y for 'yes') :");
scanf(" %c",&choice); /*Here is a space before %c*/
}while(choice=='Y' || choice=='y');
printf(“Bye Bye !!!”);
getch();
}
Output:
Nhận xét
Đăng nhận xét