用C語言寫一程式,要求輸入平時成績與期末成績,可計算出總成績。(平時成績佔30%,總成績佔70%),要求程式計算出成績後不退出,可不斷輸入。

2020-08-13 21:06:30


int main (int argc,char const  *argv[])
{
float usual = 0;
float final = 0;
float total = 0;
char c ;
char y[10] = {'\0'};
while(1)
{
	printf("請輸入平時成績與期末成績,並且用,隔開\n");
	scanf("%f,%f",&usual,&final);
	total = 0.3*usual+0.7*final;
	printf("被你的期末總成績爲:%.2f\n",total);
	//fgets(y,9,stdin);//清除快取
	//printf("y=%s\n",y);//清除快取
	//while((c =getchar()) != '\n');//清除快取
	continue;
}
return 0 ;
}