1 #include<stdio.h> 2 int main(){ 3 int i,j,n,c; 4 do{ 5 printf("Enter n(1—12):"); 6 scanf("%d",&n); 7 }while(!(n>=1&&n<=12)); 8 for(i=0;i<=n;i++){ 9 c=1; 10 for(j=1;j<=37-3*i;j++) 11 printf(" "); 12 printf("%6d",c); 13 for(j=1;j<=i;j++){ 14 c=(c*(i-j+1))/j; 15 printf("%6d",c); 16 } 17 printf("\n\n"); 18 } 19 return 0; 20 }
原文地址:https://www.cnblogs.com/geziyu/p/8783472.html
时间: 2024-10-03 06:11:20