fork(9) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int hgt = 5;
  8. int wdt = 4;
  9. int[,] a = new int[hgt, wdt];
  10. for (int y = 0; y < hgt; y++)
  11. for (int x = 0; x < wdt; x++)
  12. a[y, x] = ((x%2)==0?y:(hgt-y-1)) + 1 + x * hgt;
  13.  
  14. for (int y = 0; y < hgt; y++) {
  15. for (int x = 0; x < wdt; x++)
  16. Console.Write(a[y,x] + " ");
  17. Console.WriteLine();
  18. }
  19. }
  20. }
Success #stdin #stdout 0.02s 16024KB
stdin
Standard input is empty
stdout
1 10 11 20 
2 9 12 19 
3 8 13 18 
4 7 14 17 
5 6 15 16