Gray code by eldesh

#include <stdio.h>
main(){
int j,i=0,x=getchar()-48;
printf("Gray code  n=%d\n",x);
for(;i<1<<x;i++){
for(j=x;j;) printf("%d",(i/2^i)>>j---1&1);
puts("");}
}

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

download

return to the top page