52. C Program To find Positive, Negative, Zero among the Given N numbers.
How does this program work?
- This code helps to find positive negative zeros from the given real numbers.
Here is the code
#include <stdio.h>
int main(void)
{
int Size=10, i, a[10];
int positive = 0, negative = 0, zero=0;
printf("\nPlease Enter the Array Elements\n");
for(i = 0; i < Size; i++)
{
scanf("%d", &a[i]);
}
for(i = 0; i < Size; i ++)
{
if(a[i] > 0)
{
positive++; //Count
}
//To check negative numbers
else if(a[i] < 0)
{
negative ++;//Count
}
//To check Zeros
else if(a[i] == 0)
{
zero++; //Count
}
}
printf("\n The Count of positive Numbers in this Array = %d ", positive);
printf("\n The Count of Negative Numbers in this Array = %d ", negative);
printf("\n The Count of zeros in this Array = %d ", zero);
return 0;
}