main(){int i=-1,j,s[9],l=atoi(gets(s));printf("Gray code n=%s",s);for(;++i<1<<l;){puts("");for(j=l;j--;)putchar(1<<j&(i^i>>1)?'1':'0');}}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page