void Main()
{
//第几列
int count=1;
//当小于总列数时循环
while(count<='z'-'a'+1)
{
for(int i='a';i<'a'+count;i++)
printf("%c ",i);
count++;
printf("\n");
}
}
/*下面是C杨辉三角打印程序,他的特点是可以输入要打印的行数,比较灵活*/
#include "stdio.h"
main()
{
int yh[15][15];
int i,j,n;
printf("********************\n*打印杨辉三角数\n********************\n");
printf("请输入打印的行数n,(n<=15):");
scanf("%d",&n);
for(i=0;i
yh[i][j]=1;
else
yh[i][j]=yh[i-1][j-1]+yh[i-1][j];
}
for(i=0;i
printf("%5d",yh[i][j]);
printf("\n");
}
getch();
}
/*输入10
enter
结果:
********************
*打印杨辉三角数
********************
请输入打印的行数n,(n<=15):10
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
*/