14 May 2024 Shift 2 — Pattern: Right-Angle Triangle of Numbers
E · easyP · Verified PYQpattern-printing
Problem
Print a right-angled triangle pattern of numbers for N rows: Row 1: 1 Row 2: 1 2 Row 3: 1 2 3 … Row N: 1 2 3 … N
Example
Input
4
Output
1 1 2 1 2 3 1 2 3 4
Outer loop i from 1 to N. Inner loop j from 1 to i. Print j with space, newline after inner loop.