int order = -1;
int x=0;
int y=maxY-1;
while (x<maxX || y>0)
{
while (x<0 && y<0) {x+=2; y++; order*=-1};
while (x>=maxX && y>=maxY) {x--; y-=2; order*=-1};
while (x<0 ) {x++; order*=-1};
while (y<0 ) {y++; order*=-1};
while (y>=maxY ) {y--; order*=-1};
while (x>=maxX ) {x--; order*=-1};
gotoxy((x+1),(y+1));
printf("1");
x+=order;
y+=order;
Sleep(150);
}