Gray to Binary and Binary to Gray conversion | C # program for above approach ; Driver Code
using System ; class GFG { static int greyConverter ( int n ) { return n ^ ( n >> 1 ) ; } public static void Main ( string [ ] args ) { int n = 3 ; Console . WriteLine ( greyConverter ( n ) ) ; n = 9 ; Console . WriteLine ( greyConverter ( n ) ) ; } }