Write a program to Print Spaced 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
5
Sample Output 0
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
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=1; i<=n; i++){
for(int j=1; j<=n-i; j++){
System.out.print(" ");
}
for(int j=1; j<=i; j++){
System.out.print(j+" ");
}
System.out.println();
}
}
}