Computer Science, asked by usksss847, 9 months ago

help me please please please please please please please please please please please please​

Attachments:

Answers

Answered by tanupriyatommy
1

Answer:

/* C Program to Count Positive and Negative Numbers in an Array */

#include<stdio.h>

int main()

{

int Size=20, i, a[10];

int Positive_Count = 0, Negative_Count = 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++;

  }

  else

  {

 Negative_Count++;

  }

}

printf("\n Total Number of Positive Numbers in this Array = %d ", Positive_Count);

printf("\n Total Number of Negative Numbers in this Array = %d ", Negative_Count);

return 0;

}

Explanation:

Output be like :

Please Enter the Array Elements

>>>1 2 3 4 5 6 7 8 9 -1-2 -3 -4 -5 -6 -7 -8 -9 10 11

Total Number of Positive Numbers in this Array = 11  

Total Number of Negative Numbers in this Array = 9

Similar questions