Practice/fresherNumber Triangle
⏱ 00:00
Best: 0/100
Number PatternsTarget Time: 8 mins

Number Triangle

Given an integer N, print a number triangle where row i contains integers from 1 up to i, separated by a single space.

Input Format
A single integer N.
Output Format
Print N rows where row i contains 1 2 ... i.
Constraints:1 <= N <= 20
Concepts Required:
Loop counter as valueFormatting with space separationRow boundaries
Expected Pattern PreviewASCII Monospace
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

Notice how character spacing and row counts scale systematically based on the input N.

Concrete Examples

Example 1
Input:
5
Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

Explanation: Row i contains numbers 1 to i separated by space.

← Back to All Challenges