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