You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
411 B

#include <bits/stdc++.h>
using namespace std;
const int N = 8;
int a[N][N];
int main() {
int i, j;
int n;
cin>>n;
for (i = 0; i <= n - 1; i++) {
for (j = 0; j <= i; j++) {
if (j == 0 || j == i) a[i][j] = 1;
else a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}