Gray code by

i,j;\x0d
main(m){\x0d
\x0d
char g[9]="000000000",*c;\x0d
\x0d
scanf("%d",&i);\x0d
printf("Gray code  n=%d",i);\x0d
\x0d
g[i]='\0';\x0d
for(;i;i--)m*=2;\x0d
\x0d
for(;i++<m;*c=97-*c)\x0d
\x0d
for(printf("\n%s",c=g),j=m;(i-j/2)%j;c++)j/=2;\x0d
\x0d
}\x0d

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

download

return to the top page