anizko

08. Triangle of Numbers

May 19th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 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 _8.Triangle_of_Numbers
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             int n = int.Parse(Console.ReadLine());
  15.             int print = 1;
  16.  
  17.  
  18.             for (int i = 1; i <= n; i++)
  19.             {
  20.                 for (int j=1; j<=i;j++)
  21.                 {
  22.                     Console.Write($"{i} ");
  23.                    
  24.                     if (j == i)
  25.                     {
  26.                         Console.WriteLine();
  27.                     }
  28.                 }
  29.  
  30.  
  31.             }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment