编程打印图形
编程打印图形
00
0000
000000
00000000
0000000000
想了N久不会。。。大家帮帮忙
----------------解决方案--------------------------------------------------------
怎么显示的不像啊。。应该是中间对其的。。成三角形
----------------解决方案--------------------------------------------------------
#include<stdio.h>
void main()
{
int i,j;
for(i=1;i<6;i++)
{
for(j=1;j<6-i;j++)
printf(" ");
for(j=1;j<=i;j++)
printf("00");
putchar('\n');
}
}
----------------解决方案--------------------------------------------------------
还是懒点好
[CODE]
#include "stdio.h"
int main()
{
printf(" 00 \n");
printf(" 0000 \n");
printf(" 000000 \n");
printf(" 00000000 \n");
printf("0000000000\n");
return 0;
}
[/CODE]
----------------解决方案--------------------------------------------------------
版主好人啊
----------------解决方案--------------------------------------------------------
#include<stdio.h>
#define blank " "
#define shape "0"
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=10-2*i;j++)
printf(blank);
for(j=1;j<=2*i;j++)
printf(shape);
printf("\n");
}
getch();
}
----------------解决方案--------------------------------------------------------
#include<stdio.h>
#define blank " "
#define shape "0"
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5-i;j++)
printf(blank);
for(j=1;j<=2*i;j++)
printf(shape);
printf("\n");
}
getch();
}
输出图形
00
0000
000000
00000000
0000000000
----------------解决方案--------------------------------------------------------
以下是引用lingshangwen在2006-4-30 11:14:00的发言:
#include<stdio.h>
#define blank " "
#define shape "0"
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=10-2*i;j++)
printf(blank);
for(j=1;j<=2*i;j++)
printf(shape);
printf("\n");
}
getch();
}
#include<stdio.h>
#define blank " "
#define shape "0"
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=10-2*i;j++)
printf(blank);
for(j=1;j<=2*i;j++)
printf(shape);
printf("\n");
}
getch();
}
输出图形
00
0000
000000
00000000
0000000000
----------------解决方案--------------------------------------------------------
好人
----------------解决方案--------------------------------------------------------
反反复复...一无是处...
----------------解决方案--------------------------------------------------------