Hello,all.Following is my homework,which is the better(faster and so on).
Thanks.
A.
#include <stdio.h>
int main()
{
int i,j;
for(i=0;i<26;i++)
{
for(j=0;j<26-i;j++)
printf(" ");
for(j=0;j<i;j++)
printf("%c",j+65);
for(j=i;j>=0;j--)
printf("%c",j+65);
printf("\n");
}
return 0;
}
B.
#include <stdio.h>
int main(void)
{
int i,j;
int space;
for(i=1;i<=6;i++)
{
int c=65;
space=6-i;
for(j=1;j<=2*i-1;j++)
{
while(space>0)
{
printf(" ");
space--;
}
if(j==1)
printf("%c",c);
else if(j>1&&j<=i)
{
++c;
printf("%c",c);
}
else
{
--c;
printf("%c",c);
}
}
printf("\n");
}
}