题解 | #统计数据正负个数#
统计数据正负个数
https://www.nowcoder.com/practice/3f33889582934a09b4e3ddd3cc976226
#include <stdio.h> int main() { int a[10] = {0}; int positive_number = 0; int negative_number = 0; for (int i = 0; i < 10; i++) { scanf("%d ", &a[i]); if (a[i] > 0) { positive_number++; } if (a[i] < 0) { negative_number++; } } printf("positive:%d\nnegative:%d", positive_number,negative_number); return 0; }
c语言刷题 文章被收录于专栏
c语言刷题题目