#include <iostream>
#include <stdlib.h>
using namespace std;
//ex 1.4
void triangle_de_nbrs(int n) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n - i; j++){
cout << " ";
}
for (int j =1; j <= i; j++){
cout << j;
}
for (int j = i-1; j >= 1; j--){
cout << j;
}
cout << "\n";
}
}
int main() {
int n;
cin >> n;
triangle_de_nbrs(n);
return EXIT_SUCCESS;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: