c 16 conversion into decimal: to right-to-left with the binary of each number is multiplied by 16 of the corresponding sub-party

Source: Internet
Author: User
#include <stdio.h>/* 16 binary into decimal: to multiply each number of binary from right to left by the corresponding sub-square of 16; in 16 binary: A (a) =10 B (b) =11 C (c) =12 D (d) =13 e (E) =14 f (f) = 15 Example: ce=12*16^1+14*16^0=192+14=206*/unsigned short int right (unsigned short int num, int n) {return (num<<n) | (Num>> (num)-n);} int main (void) {unsigned short  int  num = 0xfa;//up to 4 0xFABCD error unsigned short  int num2 = 0x2345;//short int Short integer 2 bytes total 2*8=16 of bits printf ("hexadecimal number you entered:% #x \ n", num);p rintf ("% #x十六进制数转换成十进制为:%d\n", Num,num);p rintf ("The hexadecimal number is bits:% D digit \ n ", sizeof (num) *8); return 0;}

  

c 16 conversion into decimal: to right-to-left with the binary of each number is multiplied by 16 of the corresponding sub-party

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.