兴奋中,运行的很好看。。。
程序代码:
//杨辉三角。。。。 #include < stdio.h > #include < stdlib.h > #define N 11 int main ( void ) { int i, j, a[N][N]; for ( i = 1;i <N; i++ ) { a[i][1] = 1; a[i][i] = 1; } for ( i = 3; i <N;i++ ) for ( j = 2; j <= i-1; j++ ) a[i][j] = a[i-1][j] + a[i-1][j-1]; for ( i = 1; i <N ; i++ ) { for ( j = 1; j <=i; j++ ) printf ( "%5d", a[i][j] ); printf ( "\n" ); } system ( "pause" ); return ( 0 ); }