Close

Generating Gray codes

Gray code is a sequence of n-bit binary code where each pattern differs with the previous pattern by only one bit. For example 2-bit gray code is shown below. 00 01 11 10 Now we have two write a program to generate such a sequence for the given value (n). One algorithm to generate gray…