Advertisement
filipovv

num Table

Mar 8th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2.  
  3. namespace numPyramid
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             int num = 1;
  11.             for (int i = 1; i <= n; i++)
  12.             {
  13.                 for (int j = num; j < n+num; j++)
  14.                 {
  15.                     if (j > n)
  16.                     {
  17.                         Console.Write(2 * n - j);
  18.                         Console.Write(' ');
  19.                     }
  20.                     else
  21.                     {
  22.                         Console.Write(j);
  23.                         Console.Write(' ');
  24.                     }
  25.                 }
  26.                 num ++;
  27.                 Console.WriteLine();
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement