C Program to check whether the given number is positive or negative number - 6 Players blogs for technology

give us your feedback

People Online

Breaking

ads

Post Top Ad

Sunday, June 16, 2019

C Program to check whether the given number is positive or negative number

in the following program we are checking whether the input number is positive or negative
 if the number  <0 the output is print the number is negative  else if the number  >0 the output is print the number is positive


#include <stdio.h>
#include <stdlib.h>

int main()
{
int number;
printf("\n\t enter the number =");
scanf("%d",&number);
if(number<0){
    printf("\n\t %d is a Negative number",number);
}else
if (number>0){
    printf("\n\t %d is a Positive number",number);
}
    return 0;
}

the output

the first test  
enter the number = 6
6 is a Positive number 

the second test
enter the number = -6
-6 is a Negative number 


No comments:

Post a Comment

ads1

Post Top Ad