00经典程序#include""#definen37voidmain(){inti,k,j;for(i=1;i<=n;i++){for(k=1;k<=n-i;k++)printf("");for(j=1;j<=2*i-1;j++)printf("#"); printf("\n");}}#include""#definen39voidmain(){inti,k,j;for(i=1;i<=n;i++){for(k=0;k<i-1;k++)printf("");for(j=0;j<2*n-i-k;j++)printf("#");printf("\n");}}#include""#definen40voidmain(){inti,k,j,c;for(i=1;i<=n;i++){for(k=0;k<i-1;k++)printf("*");for(j=0;j<2*n-i-k;j++)printf("#"); for(c=1;c<=i-1;c++) printf("*");printf("\n");}}/*Note:YourchoiceisCIDE*/#include""#definen78/*必须是奇数*/voidmain(){inti,k,j,m;m=(n-1)/2;for(i=0;i<=(n-1)/2;i++)/*先输出(n-1)/2+1行,即i从0开始*/{for(k=0;k<m;k++)printf("");m--;for(j=0;j<=2*i;j++)printf("#"); printf("\n");}for(i=1;i<=(n-1)/2;i++)/*输出(n-1)/2行,即i从1开始,看看与上面对比*/ {for(k=1;k<i+1;k++)printf("");for(j=0;j<n-2*i;j++)printf("#"); printf("\n");}}/*Note:YourchoiceisCIDE*/#include""#definen77/*此处必须是奇数,记住是必须,否则乱套*/voidmain(){inti,k,j,m,h;m=(n-1)/2;for(i=0;i<=(n-1)/2;i++){for(k=0;k<m;k++)printf("*");m--;for(j=0;j<=2*i;j++)printf("#");for(h=0;h<=m;h++) printf("*"); printf("\n");}for(i=1;i<=(n-1)/2;i++) {for(k=1;k<i+1;k++)printf("*");for(j=0;j<n-2*i;j++)printf("#");for(h=1;h<i+1;h++) printf("*"); printf("\n");}}/*Note:YourchoiceisCIDE*/#include""#definen25voidmain(){inti,k,j,m,h;m=(n-1)/2;h=65;for(i=0;i<=(n-1)/2;i++){for(k=0;k<m;k++)printf("");m--;for(j=0;j<=2*i;j++)printf("%c",h);h++; printf("\n");}for(i=1;i<=(n-1)/2;i++) {for(k=1;k<i+1;k++)printf("");for(j=0;j<n-2*i;j++)printf("%c",h);h++; printf("\n");}}/*Note:YourchoiceisCIDE*/#include""#definen25voidmain(){inti,k,j,m,h;m=(n-1)/2;h=getchar();for(i=0;i<=(n-1)/2;i++){for(k=0;k<m;k++)printf("");m--;for(j=0;j<=2*i;j++)printf("%c",h);h++; printf("\n");}for(i=1;i<=(n-1)/2;i++) {for(k=1;k<i+1;k++)printf("");for(j=0;j<n-2*i;j++)printf("%c",h);h++; printf("\n");}}/*Note:YourchoiceisCIDE*/#include""#definen25voidmain(){ inti,k,j,m;charh='A';/*一般先定义字符窜,否则报错,谨记!*/m=(n-1)/2;for(i=0;i<=(n-1)/2;i++){for(k=0;k<m;k++)printf("");m--;for(j=0;j<=
C语言经典程序1 来自淘豆网m.daumloan.com转载请标明出处.