Floyd's Triangle

Given a positive integer n, print Floyd's Triangle. Floyd's Triangle is a right-angled triangle made of consecutive natural numbers. The first row contains 1…

Given a positive integer n, print Floyd's Triangle. Floyd's Triangle is a right-angled triangle made of consecutive natural numbers. The first row contains 1 number, the second row contains 2 numbers, the third row contains 3 numbers, and so on. Counting continues across rows without resetting — each new number is one more than the previous. Numbers within each row are separated by a single space. Each row appears on its own line. There is no trailing space at the end of any row. For n = 4, the output is: 1 2 3 4 5 6 7 8 9 10

- `1 <= n <= 20` - `n` is always a positive integer.

Example 1: input n = 3; output 1 2 3 4 5 6. Row 1 has [1]. Row 2 continues from 2: [2, 3]. Row 3 continues from 4: [4, 5, 6]. Counter never resets.

Example 2: input n = 5; output 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15. Row 4 picks up at 7 and has 4 numbers. Row 5 continues at 11 and has 5 numbers. Total numbers = 15.

Example 3: input n = 1; output 1. With only one row, the triangle contains the single number 1.

Category: Pattern Programs. Topic: pattern-programs. Difficulty: Easy. Patterns: math.