#include <stdio.h> int main() { int arr[10] = { 0 }; int z = 0 , f = 0; //z是正 f是负 for(int i = 0 ; i < 10 ; i ++) { scanf("%d",&arr[i]); //这样子搞就少写个for循环 合并起来 if(arr[i] > 0) z++; else if(arr[i] < 0) f++; } printf("positive:%d\n",z); printf("negative:%d\n",f); return 0; }