#include<stdio.h>
void coeff(int a[] , int n)
{
if(n == 1)
{
a[1] = 1;
a[2] = 1;
}
else
{
coeff(a , n-1);
a[n+1] = 1;
for(int i = n ; i >= 2; i=i--)
{
a[i] = a[i] + a[i-1];
a[1] = 1;
}
}
}
int main(void)
{
int a[100] = {0}, i , n;
scanf("%d",&n);
coeff(a , n);
for(i = 1 ; i <= n+1; i++)
{
printf("%d\t",a[i]);
}
return 0;
}
杨辉三角问题 算法编程
最新推荐文章于 2023-07-31 18:52:23 发布