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.
22 lines
316 B
22 lines
316 B
2 years ago
|
#include<bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
int main () {
|
||
|
int n,i,j,k,w;
|
||
|
scanf("%d",&n);
|
||
|
int a[35][35]= {0};
|
||
|
n=n-1;
|
||
|
a[0][0]=1;
|
||
|
for(i=0; i<=n; i++) {
|
||
|
for(j=0; j<i; j++) {
|
||
|
a[i][0]=1;
|
||
|
a[i][j+1]=a[i-1][j] +a[i-1][j+1];
|
||
|
}
|
||
|
for(k=0; k<=i; k++)
|
||
|
printf("%d ",a[i][k]);
|
||
|
printf("\n");
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|