题解 | #统计数据正负个数#
统计数据正负个数
https://www.nowcoder.com/practice/3f33889582934a09b4e3ddd3cc976226
#include <stdio.h> int main() { int a[10],i,pos=0,neg=0; for(i=0;i<10;i++) { scanf("%d",&a[i]); if(a[i]>0) pos++; else if(a[i]<0) neg++; } printf("positive:%d\nnegative:%d",pos,neg); return 0; }