c program to check value is positive or negative

#include<conio.h>
#include<stdio.h>
main()
{
int no;
clrscr( );
printf("Enter the required number to check:");
scanf("%d", &no);
if(no>0)
{
printf("\n %d is positive number",no);
}
else if(no<0)
{
printf("\n%d is negative number",no);
}
else{
printf("\nEntered Number is ZERO");
}
getch( );
return 0;
}

                                                        or

#include<conio.h>
#include<stdio.h>
main()
{
signed int a;
printf("Enter value for checking:");
scanf("%d",&a);
if(a>0)
{
printf("Positive");
}
else{
printf("Negative");
}
getch();
}

Comments

Popular posts from this blog