answersLogoWhite

0

How do you convert Binary code to BCD code?

Updated: 8/19/2019
User Avatar

Wiki User

12y ago

Best Answer
  1. #include
  2. #include
  3. void main()
  4. {int a[10],i=0,c=0,n;
  5. printf("\n enter the gray code");
  6. scanf("%d",&n);
  7. while(n!=0)
  8. {a[i]=n%10;
  9. n/=10;
  10. i++;
  11. c++;
  12. }
  13. for(i=c-1;i>=0;i--)
  14. {
  15. if(a[i]==1)
  16. {
  17. if(a[i-1]==1)
  18. a[i-1]=0;
  19. else
  20. a[i-1]=1;
  21. }
  22. }
  23. printf("\n the binary code is");
  24. for(i=c-1;i>=0;i--)
  25. printf("%d",a[i]);
  26. getch();
  27. }
User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you convert Binary code to BCD code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you convert binary number to bcd number on paper?

Example Binary 00111000 Convert to Decimal 56 Convert to BCD by using groups of four binary numbers for each digit 5 6 0101 0110


What is the decimal binary code for 30?

Decimal 30 = binary 11110. The decimal binary code (BCD), however, is 11 0000.


Why is BCD code called a weighted code?

A: A Binary code represent a binary number 0.1.2.4.8. etc. that is why it is called a weighted number


What are the 4 an invalid BCD code?

BCD code isn't valid for these integers , 10 , 11 , 12 , 13 , 14 i.e if these integers ae converted to binary code they 'd be called wrong BCD


Write an alp to convert a 2 bit number from BCD to binary?

All possible 2-bit numbers ... 0, 1, 2, and 3 ... are the same in BCD and binary. No conversion is required.


What is a 4 BCD code?

A 4 BCD code is a 4 decimal-digit BCD code, thus a 16 digit binary-code. You take the decimal number 3545. It's BCD code is 0011 0101 0100 0101 where every 4 bits represent a decimal digit.


What is the main advantage of binary coded decimal?

Binary coded decimal (BCD) is easier to convert between displayed or printed form than is pure binary.


What are different types of binary code?

BCD codes,gray code,error detecting code,ASCII character code,Excess 3 code


What are ASII and BCD how are they used?

ASCII (American Standard Code for Information Interchange) and BCD (Binary Coded Decimal) are standards for storing information in the binary sytem. ASCII is used for storing alphabetic, numeric, symbols, and control characters in 8-bit binary, and BCD is used for storing numbers 0-9 in 4-bit binary.


What is bcd to gray code converter?

A BCD to Gray code converter is a digital circuit that converts Binary Coded Decimal (BCD) input to Gray code output. Gray code is a binary numeral system where two consecutive values differ in only one bit. The converter is often used in digital systems where minimizing errors during digital-to-analog conversions is critical.


BCD to Gray Code Converter?

BCD refers to Binary Code Decimal there are no diagrams it is just a numbers system GRAY code is a means to make one reliable state to change at a time eliminating false coding because of transitions in counters and such


How do you convert binary code to text code and text to binary?

You can are ASCII-tabellen. For converting binary to text