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