Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Number_Pyramid
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int x = 1;
- for (int row = 1; row <= n; row++)
- {
- for (int col = 1; col <= row; col++)
- {
- Console.Write($"{x} ");
- x++;
- if (x > n)
- {
- return;
- }
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment