In this post students will be able to learn how to find whether a given number is zero, positive or negative with the help of algorithm, flowchart and C Programming language.
Page Contents
Write an algorithm, flowchart and program to find whether a given number is zero, positive or negative.
Algorithm:
- Start
- Initialize a variable
num
to store the input number. - Read the value of
num
from the user. - If
num
is equal to zero, print “The number is zero.” and stop. - If
num
is greater than zero, print “The number is positive.” and stop. - If
num
is less than zero, print “The number is negative.” and stop. - Stop.
FLOWCHART:

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