編制一個查詢程式,接收學生用戶輸入的5個成績(高數,英語,計算機基礎,專業課1,專業課2),按如下規則提示可以獲得的各項的獎學金,以及所有獎學金之和。
規則:
1.英語大于95分,獎學金100。
2.高數與計算機基礎任意一科大于95分,獎學金100;
3.專業課1和專業課2平均分大于95分,且其它3門課程沒有不及格的學生,獲得獎學金200
uj5u.com熱心網友回復:
這道題不難,就是判斷,寫了一段供參考
#include <stdio.h>
#include <stdlib.h>
int main()
{
int cj[5] = {0};
int i, aver = 0, total = 0;
printf("輸入成績:\n");
for (i=0; i<5; i++)
scanf("%d", &cj[i]);
aver = (cj[3] + cj[4]) / 2;
if (cj[1] > 95)
total += 100;
if (cj[0] > 95 || cj[2] > 95)
total += 100;
if (aver > 95 && cj[0] > 60 && cj[1] > 60 && cj[2] > 60)
total += 200;
printf("獎學金總數:%d\n", total);
getchar();
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/41227.html
標籤:C語言
上一篇:求求了
