Advertisement
EmoRz

Number Table

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