SHARE
TWEET

Number Pyramid

Filkolev Feb 17th, 2019 159 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.  
  9.         int lineLength = 1;
  10.         int currentLineLength = 0;
  11.  
  12.         for (int i = 1; i <= n; i++)
  13.         {
  14.             Console.Write(i + " ");
  15.             currentLineLength++;
  16.             if (currentLineLength == lineLength)
  17.             {
  18.                 Console.WriteLine();
  19.                 lineLength++;
  20.                 currentLineLength = 0;
  21.             }
  22.         }
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top