# 940 from Decimal to Gray Code

Converting a decimal number to Gray code involves converting the decimal number to binary first, then performing a binary-to-Gray-code conversion. Here's a step-by-step guide with an example for decimal number 940:

Convert the decimal number 940 to binary:

`940`

_{10} = **1110101100**_{2}

Step-by-step converting 940 from decimal to binary

Write down the first bit of the Gray code as the same as the first bit of the binary number.

`FIRST BIT OF GRAY CODE: `

**1**

The 1st bit is 1, and the 2nd bit is 1. These bits are the same, so the second bit of the Gray code is 0.

The 2nd bit is 1, and the 3rd bit is 1. These bits are the same, so the third bit of the Gray code is 0.

The 3rd bit is 1, and the 4th bit is 0. Both the bits are different, so the fourth bit of the Gray code is 1.

The 4th bit is 0, and the 5th bit is 1. Both the bits are different, so the fifth bit of the Gray code is 1.

The 5th bit is 1, and the 6th bit is 0. Both the bits are different, so the sixth bit of the Gray code is 1.

The 6th bit is 0, and the 7th bit is 1. Both the bits are different, so the seventh bit of the Gray code is 1.

The 7th bit is 1, and the 8th bit is 1. These bits are the same, so the eighth bit of the Gray code is 0.

The 8th bit is 1, and the 9th bit is 0. Both the bits are different, so the ninth bit of the Gray code is 1.

The 9th bit is 0, and the 10th bit is 0. These bits are the same, so the tenth bit of the Gray code is 0.

**940**is

**1001111010**.