grach

Number Table

Jul 20th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Number_Pyramid
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var n = int.Parse(Console.ReadLine());
  14.  
  15.             for (int row = 0; row < n; row++)
  16.             {
  17.                 for (int col = 0; col < n; col++)
  18.                 {
  19.                     var num = row + col + 1;
  20.  
  21.                     if (num > n) num = 2 * n - num;
  22.                     Console.Write(num + " ");
  23.                 }
  24.                 Console.WriteLine();
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment