#include <stdio.h> int main() { int i=10; int a=0; int positive=0; int negative=0; //输入十个数 while(i) { scanf("%d",&a); //统计正负数的个数 if(a>0) { positive++; } if(a<0) { negative++; } i--; } printf("positive:%d\nnegative:%d",positive,negative); return 0; }
#include <stdio.h> int main() { int i=10; int a=0; int positive=0; int negative=0; //输入十个数 while(i) { scanf("%d",&a); //统计正负数的个数 if(a>0) { positive++; } if(a<0) { negative++; } i--; } printf("positive:%d\nnegative:%d",positive,negative); return 0; }