Advertisement
krassy_11

NumberTable

Nov 19th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System;
  2.  
  3. class NumberTable
  4. {
  5.     static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.  
  9.         for (int row = 0; row < n; row++)
  10.         {
  11.             for (int col = 0; col < n; col++)
  12.             {
  13.                 int num = row + col + 1;
  14.                 if (num > n)
  15.                 {
  16.                     num = 2 * n - num;
  17.                 }
  18.                 Console.Write(num + " ");
  19.             }
  20.             Console.WriteLine();
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement