Gray code by hallvabo

i,j;int main(M){scanf("%d",&M);printf("Gray code  n=%d\n",M);for(;i<1<<M;i++)for(j=0;j<=M;)putchar(j++<M?48+((i/2^i)>>M-j&1):10);}

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

download

return to the top page