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