Given a limit the task is to generate the below given pattern.
5
5 4
5 4 3
5 4 3 2
5 4 3 2 1
Where limit = 5
Java
import java.util.*;
public class PatternV3
{
public static void main(String args[])
{
int n=0;
Scanner sc=new Scanner(System.in);
System.out.print("Enter a limit: ");
n=sc.nextInt();
for(int i=n;i>=1;i--)
{
for(int j=n;j>=i;j--)
{
System.out.print(j+" ");
}
System.out.println();
}
}
}Java