I\'m trying to print this big X pattern:
x x
x x
x x
x x
x
x x
x x
x x
x x
I can\'t figure out
A slight extension to one of the good solutions above for the cross ended up being a bit more than just crossing x's:
#include
int main(){
int n = 4 - 1;
char ch[] = "x";
int i = 0, dx = 1;
printf ("\n __\n ||----------------------------\n");
do {
printf (" %s %*s%*.*s %*c\n", "||", 4*i+1, ch, 8*(n-i), 8*(n-i), ch, 4*i+1, '|');
if ((i += dx)==n)
dx = -dx;
} while (i>=0);
printf (" ||----------------------------\n");
for (i = 0; i < 10; i++)
printf (" ||\n");
printf ("------\n\n");
return 0;
}
output:
$ ./bin/flag
__
||----------------------------
|| x x |
|| x x |
|| x x |
|| x |
|| x x |
|| x x |
|| x x |
||----------------------------
||
||
||
||
||
||
||
||
||
||
------