Gray code by siokoshou

using System;class P{static void Main(){int n=Console.Read()%8,i=0;for(Console.Write("Gray code  n="+n);i<1<<n;Console.Write("\n"+Convert.ToString(i^i++/2,2).PadLeft(n,'0')));}}

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

download

return to the top page