InterviewSolution
| 1. |
Write a program to enter a number and check whether the number is negative or not. Correct answer will be marked as brainliest. |
|
Answer» ong>Answer: Write a C program to check positive, negative or zero using simple if or if ELSE. C program to input any number from USER and check whether the given number is positive, negative or zero. Logic to check negative, positive or zero in C programming. Example Input Input number: 23 Output 23 is positive OR Positive or Negative Using if...else
#include
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;
} Explanation: mark me BRAINLIEST it is correct |
|