Computer Science, asked by pragya2230, 6 months ago

Write a program to find whether number is negative or positive.
Explain in detail by taking both negative and positive number as an example.​

Answers

Answered by srishti1154
2

Answer:

include <stdio.h>

int main() {

double num;

printf("Enter a number: ");

scanf("%lf", &num);

if (num <= 0.0) {

if (num == 0.0)

printf("You entered 0.");

else

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

} else

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

return 0;

}

Similar questions