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


查看12道真题和解析