課程
/后端開發(fā)
/C#
/C#開發(fā)輕松入門
2018-09-26
源自:C#開發(fā)輕松入門 6-8
正在回答
輸出語句?Console.Write( name[index] +" ");應(yīng)該放在if里面吧
? ? ? ? ? ? string[] name = new string[] { "景珍" ,";林慧洋","成蓉","洪南昌","龍玉民","單江開","田武山","王三明"};
? ? ? ? ? ? int[] score = new int[] { 90,65,88,70,46,81,100,68};
? ? ? ? ? ? int sum = 0;
? ? ? ? ? ? int avg;
? ? ? ? ? ? int index = 0;
? ? ? ? ? ? for(int i=0;i<score.Length;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? sum += score[i];
? ? ? ? ? ? }
? ? ? ? ? ? avg = sum / score.Length;
? ? ? ? ? ? Console.WriteLine("平均分是{0},"+"高于平均分的有", avg);
? ? ? ? ? ? for (int i=0;i<score.Length;i++)
? ? ? ? ? ? ? ? if(score[i]>avg)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? index = i;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.Write( name[index] +" ");
起個名字都好難
舉報
本門課程是C#語言的入門教程,將帶你輕松入門.NET開發(fā)
2 回答請問錯在哪了,請教大神
6 回答請大神指點
3 回答請問各位大神錯在那?
3 回答請教下大神們!
3 回答新手請教大神
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-10-20
輸出語句?Console.Write( name[index] +" ");應(yīng)該放在if里面吧
2018-09-27
? ? ? ? ? ? string[] name = new string[] { "景珍" ,";林慧洋","成蓉","洪南昌","龍玉民","單江開","田武山","王三明"};
? ? ? ? ? ? int[] score = new int[] { 90,65,88,70,46,81,100,68};
? ? ? ? ? ? int sum = 0;
? ? ? ? ? ? int avg;
? ? ? ? ? ? int index = 0;
? ? ? ? ? ? for(int i=0;i<score.Length;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? sum += score[i];
? ? ? ? ? ? }
? ? ? ? ? ? avg = sum / score.Length;
? ? ? ? ? ? Console.WriteLine("平均分是{0},"+"高于平均分的有", avg);
? ? ? ? ? ? for (int i=0;i<score.Length;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if(score[i]>avg)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? index = i;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.Write( name[index] +" ");
? ? ? ? ? ? }