Write a C program to check if a given Number is zero or Positive or Negative Using if...else statement.
Answers
Answered by
1
Explanation:
In the below program, to find whether A is positive, negative or zero; first the number is taken as input from the user using scanf in
A, and then A is checked for positive using
if-elsestatement and
>,
< and
== operators.
Below is the C program to find whether a number is positive, negative or zero
#include <stdio.h>
int main()
{
int A;
printf("Enter the number A: ");
scanf("%d", &A);
if (A > 0)
printf("%d is positive.", A);
else if (A < 0)
printf("%d is negative.", A)
;
else if (A == 0)
return 0;
}
printf("%d is zero.", A);
plz marks me as brainliast
Similar questions