case 0: s0 += Test.a[i]; break; case 1: s1 += Test.a[i]; break; case 2: s2 += Test.a[i]; break; } }
Console.WriteLine(s0 + \\+ s1 + \\+ s2); } }
答案:9 12 15
5.写出以下程序的功能。
static void f2(ref double[] a, int n) { int i; double sum=0; for(i=0;i if(a[i]>=sum) Console.write( a[i] + “ “ ); Console.writeLine (); } 答案:显示输出数组a中大于等于平均值的所有元素值。 6.写出以下程序运行结果。 using System; class Test { const int N=5; public static void Main (){ int a = 0; for(int i=1; i int c=0, b=2; a+=3; c=a+b; Console.write (c + “ } } “ ); 答案:5 8 11 14 7. 写出以下程序运行结果。 using System; class Test { static void LE(ref int a, ref int b) { int x = a; a = b; b = x; Console.writeLine (a + “ “ +b); } public static void Main () { int x=10, y=25; LE(ref x, ref y); Console.writeLine (x + “ “ +y); } } 答案:25 10 25 10 8.写出以下程序的功能。 static void WA(ref int[] a, int n) { for(int i=0;i 百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库C#期末考试复习题(附答案)(6)在线全文阅读。
相关推荐: