闲来无事,就研究研究c,自从大学学完,好几年都没碰了,现在看来当时学的真的很吃力或者幼稚,一些知识现在看了就懂了,那时候简直是七窍通了六窍,死记硬背。还是孔子说的好,学而时习之,温故而知新。
书不在于多,而在于精,在于运用。
#include "stdio.h"
main()
{
int i,j;
int a[10][10];
for(i=0;i<10;i++)
for(j=0;j<10;j++)
{
if(j==0)
{
a[i][j]=1;
}else if(i==j)
{
a[i][j]=1;
}else if(i<j)
{
a[i][j]=0;
}else a[i][j]=a[i-1][j-1] + a[i-1][j];
if(a[i][j]==0)
{
if(j==9)
{
printf(" \n");
}else printf(" \t");
}else printf("%d\t",a[i][j]);
}
getch();
}