下面代码运行后输出的结果是______________。 int []age=new int[]{16,18,20,14,22}; foreach(int i in age) { if(i>18) continue; Console.WriteLine(i.ToString()+" "); }
举一反三
- 下面代码的运行结果是_____________。 public class Test{ public static void main(String[] args){ int[] a=new int[3]; int[] b= new int[]{1,2,3,4,5}; a=b; for(int i=0; i<b.length; i++){ System.out.print(a[i]+" "); } } }[/i]
- 以下程序的输出结果是【 】。 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]
- 下列代码的运行结果是( )int [ ]age1=new int[ ]{10,20};int[]age2=age1;age2[1]=30;Console.WriteLine(age1[1]); A: 0 B: 10 C: 20 D: 30
- 在C#中,下列代码的运行结果是int[] num = new int[6] { 1,2,3,4,5,6 }; foreach (int i in num) { Console.Write(i); } A: 654321 B: 654321 C: 123456 D: 123456
- 下面代码的输出是什么? int [][] array = {{1, 2},{3, 4},{5,6}}; int sum = 0; for(int i = 0; i < array.length; i++) sum = sum + array[i][0]; System.out.println(sum);[/i]