用c语言编写数字金字塔

慕用2429104
浏览 3846回答 2
2回答

ruibin

#include<stdio.h>int main(){int n,i,j;    scanf("%d",&n);for(i=1;i<=n;i++){for(j=0;j<n-i;j++)printf(" ");for(j=1;j<=i;j++)printf("%d",j);for(j=i-1;j>0;j--)printf("%d",j);printf("\n");}system("pause");}

渣渣一枚啊

#include<stdio.h>int main(){int n,i,j;    scanf("%d",&n);for(i=1;i<=n;i++){for(j=0;j<n-i;j++)printf(" ");for(j=1;j<=i;j++)printf("%d",j);for(j=i-1;j>0;j--)printf("%d",j);printf("\n");}system("pause");}
打开App,查看更多内容
随时随地看视频慕课网APP