题解 | #统计数据正负个数#
统计数据正负个数
https://www.nowcoder.com/practice/3f33889582934a09b4e3ddd3cc976226
#include <stdio.h> int main() { int a, b; int neg =0, pos = 0; while (scanf("%d", &a) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to a > 0 ? pos++ : neg++; } printf("positive:%d\nnegative:%d\n", pos, neg); return 0; }