Gray code by uru

int i,j=0;main(n){for(printf("Gray code  n=%d",n=atoi(gets()));i<1<<n;i++)for(j=n+1;j;j--)printf(j>n?"\n":"%d",(i^i*2)>>j&1);}

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

download

return to the top page