利用goto,印出九九乘法表


                  int X = 1;
                  int Y = 1;
                  for1:
                  Y = 1;
                  for2:
                  Y+= 1;
                  if (Y* X <= 9)                   
                    Console.Write(Y + "X" + X + "=0" + Y * X + " ");
                  else
                    Console.Write(Y + "X" + X + "=" + Y * X + " ");
                  if (Y <= 8)
                    goto for2;
                  X += 1;
                  Console.WriteLine();
                  if (X <= 9)
                    goto for1;

沒有留言:

張貼留言