How to write a program to check a number is positive or not( negative) ?
Solution:
/* C program to check if a number is positive or not */
#include<stdio.h>
int main(void)
{
float a;
printf("enter a number to check whether it is positive or not\n");
scanf("%f",&a);
if(a>0)
{
printf("positive\n");
}
else if(a<0)
{
printf("negative\n");
}
else
{
printf("zero\n");
}
return 0;
}