Win a copy of liveProject: Build an ML Recommender System this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

question

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

7. Represent the number 6 as a hexadecimal
literal.
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Siddharth,

Welcome to the Ranch

Did you miss to post any previous part of your question? Because I see the numbering start from #7. If not the number 6 is represented as 6 in Hexa too.
 
Greenhorn
Posts: 11
Netbeans IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Integer.toHexString(6); //will do the work!!
 
Ranch Hand
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please have a look at This list of guidelines to make your Questions easily answerable..
 
Ranch Hand
Posts: 201
1
Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

siddharth lakhotia wrote:
7. Represent the number 6 as a hexadecimal
literal.



Well there are a couple of ways I know of to represent the number 6, a decimal integer, as a hexadecimal value. The easy way would be to understand that from 0 to 9 both decimal and hexadecimal are the same, so decimal 6 is also 6 in hexadecimal, its only after 9 that hexadecimal represents 10 as A, 11 as B, 12 as C, 13 as D, 14 as E, and 15 as F.

The other way would be to repeatedly divide 6 by 16 until the remainder is 0. Then the remainders in reverse order is your new hexadecimal number. I attached a graphic that explains this. There are a few webpages that talk about it too, and a few webpages with programs that do the calculation for you! : )



decimal in to hexadecimal converter with rosetta type stone graphic showing how they relate: http://www.easycalculation.com/decimal-converter.php
please find this relatively simple guide to converting base-10 to base-16: http://www.wikihow.com/Convert-from-Decimal-to-Hexadecimal
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic