Computer Science, asked by tanammenmarak, 4 months ago

write a user friendly c program demonstrating an if statement showing the value entered is negative​

Answers

Answered by pramodnagarcuraj17
1

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;

}

output

Enter a number: 12.3

Enter a number: 12.3You entered a positive number.

Similar questions