1 using System; 2 3 public class NestedLoop { nest_test()4 static public int nest_test () { 5 int n = 16; 6 int x = 0; 7 int a = n; 8 while (a-- != 0) { 9 int b = n; 10 while (b-- != 0) { 11 int c = n; 12 while (c-- != 0) { 13 int d = n; 14 while (d-- != 0) { 15 int e = n; 16 while (e-- != 0) { 17 int f = n; 18 while (f-- != 0) { 19 x++; 20 } 21 } 22 } 23 } 24 } 25 } 26 return x; 27 } 28 Main(string[] args)29 public static int Main (string[] args) { 30 int repeat = 1; 31 32 if (args.Length == 1) 33 repeat = Convert.ToInt32 (args [0]); 34 35 Console.WriteLine ("Repeat = " + repeat); 36 37 for (int i = 0; i < repeat*10; i++) 38 if (nest_test () != 16777216) 39 return 1; 40 41 return 0; 42 } 43 } 44 45 46