Gray code by pi8027 (recur)

a;main(b,c){return a?b-(1<<a)&&(putchar(c?48|(b^b>>1)>>c-1&1:10),main(b+!c,c?c-1:a)):(printf("Gray code  n=%d\n",a=getchar()-48),main(0,a));}

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

download

return to the top page