Advertisement
DaVinchester

Damnshiiiit

Mar 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5.  
  6.  
  7.  /*Please dont change namespace, Dcoder
  8.  and class must not be public*/
  9.  
  10.  //Compiler version 4.0, .NET Framework 4.5
  11.  
  12.  
  13.  namespace Dcoder
  14.  {
  15.     public class Program
  16.     {
  17.         public static void Main(string[] args)
  18.         {
  19.         int n = Convert.ToInt32(Console.ReadLine());
  20.         string[,] s = new string[n,n];
  21.         string ss = "1";
  22.         for (int i = 0; i < n - 1; i++)
  23.         {
  24.             ss = ss + " " + "2";
  25.         }
  26.         string[] sss = ss.Split(' ');
  27.         for (int i = 0; i < n; i++)
  28.         {
  29.             for (int j = 0; j < n; j++)
  30.             {
  31.                 s[i,j] = "0";
  32.             }
  33.         }  
  34.         for (int i = 0; i < n; i++)
  35.         {
  36.             int sum = 0;
  37.             for (int j = n - 1 - i; j <= n - 1; j++)
  38.             {
  39.                 s[i,j] = sss[sum];
  40.                 sum++;
  41.             }
  42.         }
  43.         for (int i = 0; i < n; i++)
  44.         {
  45.             for (int j = 0; j < n; j++)
  46.             {
  47.                 Console.Write(s[i, j] + " ");
  48.             }
  49.             Console.WriteLine();
  50.         }        
  51.         }
  52.     }
  53.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement