Gray code by naoya_t

i;main(n){char t[]="0000000";printf("Gray code  n=%s\n",gets(&n));for(t[n%=8]=0;i<1<<n;t[n-ffs(~i&++i)]^=1)puts(t);}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page