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