finding the sign (+/-) of number using condition statements
#include <stdio.h>
int main()
{
// Program to check if number is positive or negative
int a;
printf("Enter the Number (to check +ve/-ve ) : ");
scanf("%d" , &a);
if (a > 0)
{
printf("Result : %d Number is positve." , a);
}
else if (a == 0)
{
printf("Result : %d Number is zero(neither +ve or -ve)." , a);
}
else
{
printf("Result : %d Number is Negative." , a);
}
return 0;
}
No comments:
Post a Comment