當前位置:編程學習大全網 - 電腦編程 - 輸入20個有符號整數,統計正整數、零、負整數的個數。拜托各位了 3Q

輸入20個有符號整數,統計正整數、零、負整數的個數。拜托各位了 3Q

#include<stdio.h> main() { int count1=0;//負數 int count2=0;//0 int count3=0;//正數 int a[20]; int i; for(i=0;i<20;i++) { scanf("%d",&a[i]); if(a[i]<0) { count1++; } else if(a[i]>0) { count3++; } else { count2++; } } printf("負數:%d 0:%d 正數:%d\n",count1,count2,count3); }

  • 上一篇:matlab中beta什麽意思
  • 下一篇:電腦鑼換刀指令是什麽
  • copyright 2024編程學習大全網