C program to check if a given Number is zero or Positive or Negative Using if...else statement

C program to check if a given Number is zero or Positive or Negative Using if...else statement:

For example, if the user has entered 14.05 then the output will be: 

Positive Number


#include<stdio.h> 
int main()
{
    float number;
    scanf("%f", &number); 
if (number <= 0.0)
    {
        if (number == 0.0)
            printf("The number is 0.\n");
        else
            printf("Negative number.\n");
    }
    else
        printf("Positive number.\n");
    return 0;
}




--------------------------------

NOTE: You have any problem in above C Program do not hesitate and write your problem in the comment box. I will support your problem.

Share this

0 Comment to "C program to check if a given Number is zero or Positive or Negative Using if...else statement"

Post a Comment