C program to check a given number is positive or negative





C program to check a given number is positive or negative


#include<stdio.h>
int main(){
    int num;
    scanf("%d",&num);
   
    if(num ==0)
         printf("Number is zero.");
    else if(num > 0)
printf("Number is positive.");
else
printf("Number is negative.");
    return 0;
}


Algorithm:

A number greater than zero is termed a positive number, and a number less than zero is labeled a negative number. Notably, zero stands at the boundary between positive and negative numbers and is distinct from both.


No comments: