當前位置:編程學習大全網 - 編程軟體 - 編程統計全班學生成績。要求每次用鍵盤輸入壹個學生的2門分數,計算輸出每個學生

編程統計全班學生成績。要求每次用鍵盤輸入壹個學生的2門分數,計算輸出每個學生

#include<stdio.h>

void main()

{

int score1,score2,score,well,good,all,n;

double score_ave;

printf("請輸入全班人數:\n");

scanf("%d",&all);

printf("依次輸入成績:\n");

well=0;

good=0;

for(n=1;n<=all;n++)

{ scanf("%d,%d",&score1,&score2);

score=score1+score2;score_ave=(score1+score2)/2;

if(score_ave>=0&&score_ave<60)

{printf("不及格\n"); printf("%d,%f\n",score,score_ave);}

else if(score_ave>=60&&score_ave<85)

{good++; printf("通過\n"); printf("%d,%f\n",score,score_ave);}

else if(score_ave>=85&&score_ave<=100)

{well++; printf("優秀\n"); printf("%d,%f\n",score,score_ave);}

else

printf("錯誤\n");

}

printf("優秀人數:%d通過人數:%d\n",well,good);

}

  • 上一篇:-1在C語言環境下存儲對應的二進制數序到是?
  • 下一篇:面試的時候會要求程序員手工寫代碼嗎?
  • copyright 2024編程學習大全網