程序代码:
#include<stdio.h>
int triangle(int m,int n)
{
if( m==n || m==0)
return 1;
else
return ( triangle( m-1,n-1 ) + triangle(m,n-1) );
}
int main()
{
int i,j;
for(j=1;j<=10;j++)
{
for( i=0;i<=j;i++)
{
printf("%d ",triangle(i,j));
}
printf("\n");
}
return 0;
}