Tuesday, 17 December 2019

To check whether a number is positive or negative

#include<stdio.h>
#include<conio.h>
main()
{
int n;
printf("Enter a number ");
scanf("%d",&n);
if(n>0)
printf("The given number %d is positive..",n);
else if(n<0)
printf("The given number %d is negative..",n);
else
printf("The given number %d is zero",n);
getch();
}

No comments:

Post a Comment

Convey your thoughts to authors.