下面程序段的运行结果 static void Main(string[] args) { int a = 0; for (int i = 1; i < 5; i++) { int c = 0, b = 2; a += 3; c = a + b; Console.Write(c + ","); } } 程序运行结果是( )
举一反三
- 写出以下程序运行结果。const int N=5; public static void Main (){ int a = 0; for(int i=1; i<;N; i++) { int c=0, b=2; a+=3; c=a+b; Console.write (c + “ ” ); }程序运行后输出结果为:____
- 以下程序的运行结果为? class Test2{ public static void main(String[] args) { int[] seeds = {1,2,3,5}; int n = seeds.length; for (int i = 0; i < 2; i++) for (int k = 0; k< n-1; k++) seeds[k]= seeds[k+1]; for (int i = 0; i 输出: 3 5 5 5
- 下面程序的运行结果是 public class Test { public static void main(String[] args) { int temp = 0; for (int i = 1; i < 5; i++) { for (int j = 0; j < i; j++) { temp++; } } System.out.println(temp); } }
- 以下程序的输出结果是【 】。 class Program { public static void Main(string[] args) { int[] a = new int[3] { 1, 2, 3 }; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); int[] b = a; for (int i = 0; i < 3; i++) b[i] = 2 * b[i]; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); Console.Read(); } }[/i][/i][/i][/i]
- 写出以下程序运行结果。using System;class Test{const int N=5;public static void Main (){int a = 0;for(int i=1; i<;N; i++) {int c=0, b=2;a+=3; c=a+b;Console.writeLine (c + ““ );}}}