Check whether the number is positive or negative

CODE




Check whether the number is positive or negative
Program to check whether the no is +ve or-ve

int main()
{
    float a;
    printf("\n enter a number:");
    scanf("%f",&a);
    if(a<0)
        printf("\n number is negative");
    else
        printf("\n number is positive");
}


Output:
enter a number:
56

 number is positive

AND
enter a number:
-78

 number is negative

Check whether the number is positive or negative Check whether the number is positive or negative Reviewed by Unknown on December 14, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.