Given a number A. The task is to check whether A is positive, negative or zero.
Input: A = 2 Output: 2 is positive Input: A = -554 Output: -554 is negative
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 , and then A is checked for positive using statement and , and operators.
Below is the C program to find whether a number is positive, negative or zero.
Enter the number A =: -54 -54 is negative.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.