public class NumberTriangleRecursive {
public static void main(String[] args) {
int n = 5;
printNumberTriangleRecursive(n, 1);
}
public static void printNumberTriangleRecursive(int n, int currentRow) {
if (currentRow > n) {
return;
}
printNumbers(currentRow, currentRow);
System.out.println();
printNumberTriangleRecursive(n, currentRow + 1);
}
public static void printNumbers(int number, int count) {
if (count == 0) {
return;
}
System.out.print(number + " ");
printNumbers(number, count - 1);
}
}