2-4. BCD decryption (10), 2-4 BCD decryption 10

Source: Internet
Author: User

2-4. BCD decryption (10), 2-4 BCD decryption 10

BCD is a two-digit decimal number expressed in one byte. Each four bits represents one digit. Therefore, if the hexadecimal value of a BCD number is 0x12, it represents 12 in decimal format. However, James did not learn BCD, and converted all BCD numbers into decimal numbers. Therefore, 0x12 of BCD is output to 18 in decimal format!

Now, your program will read the incorrect decimal number and output the correct decimal number. Tip: You can convert 18 to 0x12 and then to 12.

Input Format:

The input gives a positive integer in the range of [0,153] in a row to ensure that the number of BCD is converted back to a valid number, that is, this integer is converted to a hexadecimal number without a A-F.

Output Format:

Output the corresponding decimal number.

Input example:

18

Output example:

12



1 # include <stdio. h> 2 3 int main () 4 {5 int x; 6 scanf ("% d", & x); 7 int n; 8 n = x/16*10 + (x-x/16*16); 9 printf ("% d", n); 10 11 return 0; 12}

The 6789 (BCD) Code of (8421) 10 is

(6789) 10 8421 (BCD) Code
0110 0111 1000 1001

OK?

How to unlock Hisense BCD-237 inverter refrigerator buttons

1. Press the "Frozen" and "Frozen" keys for 5 seconds and then release them;

2. Unlock the lock for more than 2 seconds.
If you have a manual, take a look.
Try it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.