Computer Science, asked by Gunnu3595, 10 months ago

Write a c program to check whether a number is positive or negative

Answers

Answered by sushiladevi4418
5

Answer:

C program to check whether a number is positive or negative

Explanation:

include <stdio.h>

int main()

{

   double number;

   printf("Enter a number: ");

   scanf("%lf", &number);

   if (number <= 0.0)

   {

       if (number == 0.0)

           printf("You entered 0.");

       else

           printf("You entered a negative number.");

   }

   else

       printf("You entered a positive number.");

   return 0;

}

Similar questions