In this article, we will learn how to print Reverse Number Pattern
Input: N=4
Output:
1
2 1
3 2 1
4 3 2 1
JavaScript Solution:
function printPattern(n) {
for (let i = 1; i <= n; i++) {
let str = "";
for (let j = i; j >= 1; j--) {
str += j;
}
console.log(str);
}
}
Java Solution:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
for (int i = 1; i <= n; i++) {
for (int j = i; j >= 1; j--) {
System.out.print(j);
}
System.out.println();
}
}
}
C++ Solution:
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = i; j >= 1; j--) {
cout << j;
}
cout << endl;
}
return 0;
}
Python Solution:
for i in range(1, n+1):
for j in range(i, 0, -1):
print(j, end="")
print()
Time Complexity: O(n*n)
Space Complexity: O(1)
To Practice this Question on GFG
Other Questions on patterns:
Program to print square pattern
Program to print right angle triangle star pattern
Program to print right angle triangle number
Print inverted right angle triangle star pattern


I enjoyed reading your piece and it provided me with a lot of value.
Thank you for your post. I really enjoyed reading it, especially because it addressed my issue. It helped me a lot and I hope it will also help others.
Great content! Super high-quality! Keep it up!