题解 | 统计数据正负个数
统计数据正负个数
https://www.nowcoder.com/practice/3f33889582934a09b4e3ddd3cc976226
#include <stdio.h>
int main() {
int num, i, negative = 0;
int positive = 0;
for (i = 1; i <= 10; i++) {
scanf("%d", &num);
if (num > 0) {
positive++;
}
else {
negative++;
}
}
printf("positive:%d\n",positive);
printf("negative:%d\n",negative);
return 0;
}
联想公司福利 1502人发布