Computer Science, asked by srijitamayra35, 7 months ago

Write a program to enter a number and check weather it is positive or negative​

Answers

Answered by Anonymous
2

Answer:

Check Positive or Negative Using if...else

#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;

}

You can also solve this problem using nested if else statement.

Similar questions