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

Inverted Number Triangle

Given an integer N, print an inverted number triangle where the first row contains numbers from 1 to N, the second row contains 1 to N-1, and so on until 1.

Input Format
A single integer N.
Output Format
Print N rows with decreasing count of numbers.
Constraints:1 <= N <= 20
Concepts Required:
Decrementing outer loopInner loop bound by outer variableSpace formatting
Expected Pattern PreviewASCII Monospace
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

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

Concrete Examples

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

Explanation: Row i has numbers from 1 to N - i + 1.

← Back to All Challenges