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