c語言輸出n行楊輝三角 用C語言編寫一個輸出10行的楊輝三角形程序?
用C語言編寫一個輸出10行的楊輝三角形程序?#includeint a(int rows,int n){float p=1。for(int count=2count<=ncount){p=p*(r
用C語言編寫一個輸出10行的楊輝三角形程序?
#include
int a(int rows,int n)
{
float p=1。
for(int count=2count<=ncount)
{
p=p*(rows count 1)/(count-1)
}
return(int)p
}
int print(int rows)
{
if(rows<=1)
{
printf(“1
”)}else{
print(rows-1)
for(int)n=1n<=rowsn)
{
printf(“%d”,a(rows,n))
}
printf(“
”)
return 0
}
int main(int argc,char*argv[])
{
print_uu2;triangle(10)
return 0
C語言求楊輝三角前10行的?
效果圖11 11 11 121 1331 14641 14641 15141 15115101051161520115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115115167670562881 19368416126843691請按任意鍵繼續(xù)。。。源代碼:源代碼:ltdio。該公司目前在中國(I=1I<=10I)為(I=1I<=10I)為(J=1J<=10I)為(J=1J<=10I)為(J=1J<=10I)為(J=1J<=ij)為(J=1J<=ij)的 1個3:a[i][J]=1[i-1][J-1]a[i-1][J]其他元素等于兩個肩部元素之和。祝你好運!