Count positive and negative in C Programming

Count positive and negative
Image result for c programming
Code:
  #include<stdio.h>
int main()
{
  int n,i,j[20],count=0,count1=0;
  printf("Enter the value of n\n");
  scanf("%d",&n);
  for (i=0;i<n;i++)
  {
    printf("Enter the number\n");
    scanf("%d",&j[i]);
    if(j[i]>=0)
     count++;
    else if(j[i]<0)
      count1++;
  }
  printf("Number of positive numbers entered is %d and the number of negative numbers entered is %d",count,count1);
  return 0;
}

No comments