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