當前位置:編程學習大全網 - 電腦編程 - 用數組編寫輸入30個學生數學成績,統計顯示他們的總分、平均分、最低

用數組編寫輸入30個學生數學成績,統計顯示他們的總分、平均分、最低

C# ?代碼:

void?ScoreShow(){

double[]?score?=?new?double[30];

double?scoreNum=0;

double?scoreBig=0;

double?scoreSmall=10000;

for(int?i=0;i<30;i++){

score[i]=input.nextdouble();

scoreNum=scoreNum+score[i];

if(score[i]>scoreBig){

scoreBig=score[i];

}

if(score[i]<scoreSmall){

scoreSmall=score[i];

}

}

system.out.println("總分"+scoreSmall+"平均分"+scoreSmall/30+最高分+scoreBig+最低分+scoreSmall);

}

  • 上一篇:批處理怎麽寫,妳懂編程語言嗎?那些語句是用什麽代碼寫的?
  • 下一篇:如何調試html網頁中的js代碼
  • copyright 2024編程學習大全網