World's most popular travel blog for travel bloggers.

[Solved]: Conversion from Decimal form to BCD

, , No Comments
Problem Detail: 

I have seen a way how to convert a decimal number to BCD (packed & unpacked) using 8,4,2,1 weighing forms but how to do it using 4,2,2,1 and 7,4,2,1 ? Any method please.Suggestions

Asked By : tonny

Answered By : Totoro

If we want to represent 8 base 10 then it will be represented as follows:

A) 7421 code    8(10)= 7+1 = 8            1 0 0 1 -> 7 4 2 1 code    1x7+4x0+2x0+1x1=7+0+0+1=8    8(10)=1001(7421)  B) 5421 code    8(10)= 5+2+1     therefore   5 4 2 1                1 0 1 1   8(10)= 1011(5421)  C) 4221 code    8(10)= 4+2+2    therefore 4 2 2 1              1 1 1 0    8(10)= 1110(4221) 

There you go. If this is helpful then please select this as an answer.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/33063

0 comments:

Post a Comment

Let us know your responses and feedback