Write a program to Print Inverted Right-angled whole numbers
Take an integer input n and Print the pattern.
Input Format
A single line n take input from user.
Constraints
1<=n<=100
Output Format
Print the pattern.
Sample Input 0
7
Sample Output 0
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Also read: WAP to Print Inverted Right Angled Triangle Pattern
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=n; i>=1; i--){
for(int j=1; j<=i; j++){
System.out.print(j+" ");
}
System.out.println();
}
}
}