Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 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 digits
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int count = 1;
  15.  
  16.             for (int row = 0; row <= n; row++)
  17.             {
  18.                 for (int col = 0; col <= row; col++)
  19.                 {
  20.                     Console.Write($"{count} ");
  21.                     count++;
  22.                     if (count > n)
  23.                     {
  24.                         break;
  25.                     }
  26.                 }
  27.                
  28.                 Console.WriteLine();
  29.                
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement