请问这个用C语言编程怎么写?在线等,谢谢
展开全部
第一个图形:
#include<stdio.h>
int main(void)
{
int totalLine=5;
int column=0;
int line;
for (line=1; line<totalLine+1;line++)
{
for (column=totalLine; column>line; column--)
printf(" ");
for (column = 1; column < line; column++)
printf("%d", column);
for (column=line; column >=1;column--)
printf("%d", column);
printf("\r\n");
}
return 0;
}
或者:
#include<stdio.h>
int main(void)
{
int totalLine=5;
int column=0;
int line;
int ASIICbase = 48;
for (line=1; line<totalLine+1;line++)
{
for (column=totalLine; column>line; column--)
printf(" ");
for (column = 1; column < line; column++)
printf("%c", column+ASIICbase);
for (column=line; column >=1;column--)
printf("%c", column+ASIICbase);
printf("\r\n");
}
return 0;
}
第二个图形:
#include<stdio.h>
int main(void)
{
int totalLine=5;
int column=0;
int line;
int ASIICbase = 64;
for (line=1; line<totalLine+1;line++)
{
for (column=totalLine; column>line; column--)
printf(" ");
for (column = 1; column < line; column++)
printf("%c", column+ASIICbase);
for (column=line; column >=1;column--)
printf("%c", column+ASIICbase);
printf("\r\n");
}
return 0;
}
#include<stdio.h>
int main(void)
{
int totalLine=5;
int column=0;
int line;
for (line=1; line<totalLine+1;line++)
{
for (column=totalLine; column>line; column--)
printf(" ");
for (column = 1; column < line; column++)
printf("%d", column);
for (column=line; column >=1;column--)
printf("%d", column);
printf("\r\n");
}
return 0;
}
或者:
#include<stdio.h>
int main(void)
{
int totalLine=5;
int column=0;
int line;
int ASIICbase = 48;
for (line=1; line<totalLine+1;line++)
{
for (column=totalLine; column>line; column--)
printf(" ");
for (column = 1; column < line; column++)
printf("%c", column+ASIICbase);
for (column=line; column >=1;column--)
printf("%c", column+ASIICbase);
printf("\r\n");
}
return 0;
}
第二个图形:
#include<stdio.h>
int main(void)
{
int totalLine=5;
int column=0;
int line;
int ASIICbase = 64;
for (line=1; line<totalLine+1;line++)
{
for (column=totalLine; column>line; column--)
printf(" ");
for (column = 1; column < line; column++)
printf("%c", column+ASIICbase);
for (column=line; column >=1;column--)
printf("%c", column+ASIICbase);
printf("\r\n");
}
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询