Q:

C PROGRAM TO CHECK WHETHER GIVEN NUMBER IS POSITIVE OR NEGATIVE:C PROGRAM TO CHECK WHETHER GIVEN NUMBER IS POSITIVE OR NEGATIVE:

0

C PROGRAM TO CHECK WHETHER GIVEN NUMBER IS POSITIVE OR NEGATIVE:

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
 
int main()
 
{
 
    float n;
 
    printf("Please enter a number\n");
 
    scanf("%f",&n);
 
    
 
    if (n==0)
 
        printf("\nEntered number is 0. It's neither positive or negative");
 
    else if (n<0)
 
        printf("\nEntered number %.2f is negative.",n);
 
    else
 
        printf("\nEntered number %.2f is positive.",n);
 
    return 0;
 
}

Output:

Please enter a number

-15

 

Entered number -15.00 is negative.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now