Compare commits
No commits in common. '打印菱形' and 'master' have entirely different histories.
@ -1,33 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
void diamond(int x,char c)
|
|
||||||
{
|
|
||||||
int i,j,mid;
|
|
||||||
mid = x/2 + 1;
|
|
||||||
if(x%2!=0){
|
|
||||||
for(i=1;i<=mid;i++)
|
|
||||||
{
|
|
||||||
for(j = 1;j <= mid-i;j++)
|
|
||||||
printf("\t");
|
|
||||||
for(j = 1;j <= 2*i-1;j++ )
|
|
||||||
printf("%c\t",c);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=mid+1;i<=x;i++){
|
|
||||||
for(j = 1;j <=i-mid;j++)
|
|
||||||
printf("\t");
|
|
||||||
for(j = 1;j <= x- 2*(i-mid);j++)
|
|
||||||
printf("%c\t",c);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else printf("error!\n");
|
|
||||||
}
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
char c;
|
|
||||||
scanf("%d,%c",&x,&c);
|
|
||||||
diamond(x,c);
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in new issue