C Program To Count Number Of Positive And Negative Number | C Programming
C Program To Count Number Of Positive And Negative Numbers #include <stdio.h> int main () { int a [ 50 ],n,count_neg= 0 ,count_pos= 0 ,i; printf ( "Enter the size of the array \n " ); scanf ( " %d " ,&n); printf ( "Enter the elements of the array \n " ); for (i= 0 ;i < n;i++) scanf ( " %d " ,& a [i]); for (i= 0 ;i < n;i++) { if ( a [i] < 0 ) count_neg++; else count_pos++; } printf ( "There are %d negative numbers in an array \n " ,count_neg); printf ( "There are %d positive numbers in an array \n " ,count_pos); return 0 ; } Output For Above Program