#include<stdio.h>
int main()
{
    int c[200][200]={0},i,j,x,a=1,k;
    printf("please enter the line you need:");
    scanf("%d",&x);
    for(i=0;i<x;i++)
    {
        for(j=0;j<=i;j++)
        {
            if(i==j||j==0)c[i][j]=1;
            else c[i][j]=c[i-1][j-1]+c[i-1][j];
        }
    }
    for(i=0;i<x;i++)
    {
        for(k=0;k<x-i;printf("   "),k++);
        for(j=0;j<=i;j++)
        {
            printf("%6d",c[i][j]);
        }
        puts("");
    }
return 0;
}

 

posted on 2012-04-13 10:09  C's  阅读(184)  评论(0编辑  收藏  举报