查看單個文章
舊 2005-10-18, 11:12 PM   #9 (permalink)
天上天下
註冊會員
 
天上天下 的頭像
榮譽勳章

勳章總數0
UID - 3073
在線等級: 級別:1 | 在線時長:8小時 | 升級還需:4小時
註冊日期: 2002-12-06
VIP期限: 2005-12
文章: 89
精華: 0
現金: 1 金幣
資產: 1 金幣
預設

可是這題怎麼不會??
#include <stdio.h>
main()
{
int i;
float score, sum;
sum = 0.0;
i = 0;
printf("Enter next score (negative to quit ) : ");
scanf("%f",&score);
while (score >= 0)
{
sum += score;
i++;
printf("Enter next score (negative to quit ) : ");
scanf("%f",&score);
}
printf("Total %d scores counted\n",i);
printf("Total score : %8.2f \n",sum);
printf("Average score : %8.2f \n",sum/i);
}
天上天下 目前離線  
送花文章: 4, 收花文章: 1 篇, 收花: 1 次
回覆時引用此帖