Input a positive integer n, and output an upper triangular digital triangle with n layers.
Input format:
There is only one positive integer n, 1<=n<=100.
Output format:
an upper triangle number triangle, each number occupies four character positions.
Input example:
5
Sample output:
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int num=1 ;
for (int i = 0; i < n ; i++) {
for (int j = 0; j <n-i; j++) {
System.out.printf("%4d",num++);
}
System.out.println();
}
}
}