Conversion of Binary to Gray
Let us convert the binary number 1010 to Gray Code.
Step 1: The left most Gray digit is the same as the left most binary digit.

Step 2: Add the left most binary digit to adjacent one (regardless of the carry).

Step 3: Add the next adjacent pair

Step 4: Add the last adjacent pair

The conversion is now completed and the Gray Code is 1111.
Conversion of Gray to Binary
Let us convert the Gray Code 1111 to Binary number.
Step 1: The left most Binary digit is the same as the left most Gray digit.

Step 2: Add the left most Binary digit to the adjacent Gray digit.

(1+1=2 which is 10 in binary, put the first bit 0 and ignore the carry 1)
Step 3: Add the next binary digit to the next Gray digit like step 2.

Step 4: Add the next binary digit to the next Gray digit like step 2.

(1+1=2 which is 10 in binary, put the first bit 0 and ignore the carry 1)
The conversion is now completed and the Binary number is 1010.
