#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
//变量声明语句
int linenum, currline,spacenum,chnum;
char ch;
//输入提示
printf("请输入三角形的行数及构成三角形的符号:");
scanf("%d %c",&linenum,& ch);
//数据处理
currline = 1;
while (currline <= linenum)
{
//画当前行
//(1)先画前面的llinenumm-currline个空格
spacenum = 1;
while (spacenum <= linenum - currline)
{
printf(" ");
spacenum = spacenum + 1;
}
//(2)再画后面的2*currline-1个字符
chnum = 1;
while (chnum <= 2 * currline - 1)
{
printf("%c", ch);
chnum = chnum + 1;
}
//(3)输出回车
printf("\n");
//下一行
currline = currline + 1;
}
return 0;
}