编辑代码

public class NonRecursiveNumbers {
    public static void main(String[] args) {
        int n = 5;
        printNumbersNonRecursively(n);
    }

    public static void printNumbersNonRecursively(int n) {
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < i; j++) {
                System.out.print(i + " ");
            }
            System.out.println();
        }
    }
}