# Codes Conversion - Computer Logical Organization

## What are the different methods used for converting code from one format to another?

The following are the different methods used for converting code from one format to another:

• Binary to BCD Conversion
• BCD to Binary Conversion
• BCD to Excess-3
• Excess-3 to BCD

## How to convert Binary code to BCD code?

The following are the steps to convert Binary code to BCD code:

• Step 1 – The binary number is converted to decimal.
• Step 2 – The decimal number is converted to BCD.

Example − convert (11101)2 to BCD.

### Step 1 − Convert to Decimal

Binary Number − 111012

Calculation of Decimal Equivalent is as follows:

 Step Binary Number Decimal Number Step 1 111012 ((1 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20))10 Step 2 111012 (16 + 8 + 4 + 0 + 1)10 Step 3 111012 2910

Hence,

Binary Number − 111012 = Decimal Number − 2910

### Step 2 − Convert to BCD

Decimal Number − 2910

Calculation of BCD Equivalent is as follows:

 Step Decimal Number Conversion Step 1 2910 0010210012 Step 2 2910 00101001BCD

Result

## How to convert BCD code to Binary code?

• Step 1 – The BCD number is converted to decimal.
• Step 2 – The decimal is converted to binary.

Example − convert (00101001)BCD to Binary.

### Step 1 - Convert to BCD

BCD Number − (00101001)BCD

Calculation of Decimal Equivalent is as follows.The decimal equivalent is obtained by converting each four digit into a group.

 Step BCD Number Conversion Step 1 (00101001)BCD 0010210012 Step 2 (00101001)BCD 210910 Step 3 (00101001)BCD 2910

Hence,BCD Number − (00101001)BCD = Decimal Number − 2910

### Step 2 - Convert to Binary

For converting decimal to binary, long division method is used.

Decimal Number − 2910

Calculation of Binary Equivalent is as follows:

 Step Operation Result Remainder Step 1 29 / 2 14 1 Step 2 14 / 2 7 0 Step 3 7 / 2 3 1 Step 4 3 / 2 1 1 Step 5 1 / 2 0 1

The last remainder should be MDS and the first remainder should be LSD.

Hence,Decimal Number − 2910 = Binary Number − 111012

Result

## How to convert BCD code to Excess-3 code?

The following are the steps to convert BCD code to Excess-3 code:

• Step 1 – BCD is converted to decimal.
• Step 2 -- Add 3 to the decimal number.
• Step 3 – Excess-3 code is obtained by converting into binary.

Example − convert (1001)BCD to Excess-3.

(1001)BCD = 910

### Step 2 − Add 3 to decimal

(9)10 + (3)10 = (12)10

(12)10 = (1100)2

Result

## How to convert Excess-3 code to BCD?

The following are the steps to convert Excess-3 code to BCD:

• Step 1 – For the corresponding BCD Code, (0011) is subtracted from each 4 bit of excess-3 digit.

Example − convert (10011010)XS-3 to BCD.

Result