#include <stdio.h>
void printNumbersRecursively(int n) {
if (n > 0) {
printNumbersRecursively(n - 1);
for (int i = 0; i < n; ++i) {
printf("%d ", n);
}
printf("\n");
}
}
void printNumbersNonRecursively(int n) {
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < i; ++j) {
printf("%d ", i);
}
printf("\n");
}
}
int main() {
int n = 7; //n
printf("递归实现:\n");
printNumbersRecursively(n);
printf("\n非递归实现:\n");
printNumbersNonRecursively(n);
return 0;
}