Computer Science, asked by bhardwajpranjal2013, 7 months ago

Write a program to enter a number and check whether the number is negative or not.
Correct answer will be marked as brainliest.

Answers

Answered by Kingofsky
1

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

}

Explanation:

mark me brainliest it is correct

Answered by pandeykhushi048
1

Answer:

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;

}

Similar questions