❶ 用c語言編寫一個程序,輸入一個成績,判斷該成績是否及格。
#include"stdio.h"
intmain()
{
intscore;
printf("請輸入一個成績:");
scanf("%d",&score);
if(score>60&&score<=100)
printf("成績合格 ");
elseif(score<60&&score>=0)
printf("成績不合格 ");
else
printf("輸入的成績有誤 ");
}
❷ 如何用C語言輸出考試成績的優秀,良好,及格,不及格
#include <stdio.h>void main(){int score;scanf("%d",&score);//輸入成績if(score>=90) printf("優秀");else if(score>=70&&score<90) printf("良好");else if(score>=60&&score<70) printf("及格");else if(score<60) printf("不及格!");}
❸ 跪求C語言大神,任意輸入一個成績,給出評語,90~100優秀,80~89良好,60~79及格,0~
#include"stdio.h"
intmain(void){
char*lev[11]={"不及格","不及格","不及格","不及格","不及格",
"不及格","及格","及格","良好","優秀","優秀"},sco;
while(1){
printf("Pleaseenterthescores(int0~100)... ");
if(scanf("%d",&sco)&&sco>=0&&sco<=100)
break;
fflush(stdin);
printf("Error,redo:");
}
printf("%d<-->%s ",sco,lev[sco/10]);
return0;
}
❹ c語言編程 統計學生成績 60及格 及格人數與不及格人數
#include<stdio.h>
intmain()
{
intt,r=0,i;
floats;
printf("請輸入總人數:");
scanf("%d",&t);
printf("請輸入%d個分數:",t);
for(i=0;i<t;i++)
{
scanf("%f",&s);
if(s>=60)r++;
}
printf("及格人數%d,不及格人數%d ",r,t-r);
}