最好的c语言编程学习材料
#include
main()
{
long i,j,n,k;
scanf("%ld",&n);
for(i=1;i<=n;i++)
{
k=1;
for(j=1;j
{
printf("%ld ",k);
k=k*(i-j)/j;
}
printf("1\n");
}
}
#define N 13 //定义三角最大行,可自行设定,但最大不要超过65536; #include
main(){
int n,i,j;
int a[N+1][2*N+4];
printf("How Many Rows Do You Want:(Number Must Below Or Equal %d)\n",N); scanf("%d",&n);
if(n>N){
printf("What You Input Is Big Than What We Provide!\n");
exit(1);
}
//初始化数组;
for(i=1;i<=n;i++){
for(j=-1;j<2*n+2;j++){
a[i][j]=0;
}
}
a[1][n]=1;
//设置杨辉三角的数值;
for(i=1;i<=n;i++){
for(j=1;j<2*n;j++){
if(a[i][j]!=0){
a[i+1][j-1]=a[i][j-2]+a[i][j];