#include"stdio.h"
int main()
{
int row, row_all, blank, row_plus, row_minus;
char ch;
printf("输入一个大写字母\n");
scanf("%c", &ch, 1);//
row_all = ch - 'A' + 1;//计算输入字母所需的所有行
for (row = 1; row <= row_all; row++)//每一行循环
{
for (blank = 0; blank < row_all - row; blank++)//处理空格
printf("%c", ' ');
for (row_plus = 0; row_plus < row; row_plus++)//升序打印字母
printf("%c", 'A' + row_plus);
for (row_minus = row - 2; row_minus >= 0; row_minus--)
//降序打印字母 row-2是从第二行有倒序
printf("%c", 'A' + row_minus);
printf("\n");
}
return 0;
}
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- awee.cn 版权所有 湘ICP备2023022495号-5
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务