• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Hexadecimal query

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me how 0x1c equates to 28 please?
I know that hex is base 16 and c has a value of 12, but that's about as far as I got with it.
 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


Can anyone tell me how 0x1c equates to 28 please?
I know that hex is base 16 and c has a value of 12, but that's about as far as I got with it.


0x1c = (16^1 * 1) + (16^0 * 12)
= 16 + 12
= 28.
Hope that helps.
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its easy to convert a hexadecimal into a decimal.
For eg. lets take your number,0x1c
first multiply the last digit of the hexadecimal number by 16 to the power 0.
c=12
12*16to the power 0=12*1=12
then multiply the next digit by 16 to the power 1
1*16 to the power 1=1*16=16
Then add the products which you got after multiplication.
16+12=28.Thats it!
If there are more digits,then keep on increasing the power.
For eg,if there was a third digit 2 in your number,then it would be multiplied by 16 to the power 2.
I hope that helps.
By the way,there have been numerous threads in this forum,which have talked about this topic.
You can search for them.
Regards
Gautam
 
Rob Petterson
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks chaps, for your quick responce
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic