Jump to content

Binary covert to decimal help


Niklas111
 Share

Recommended Posts

So this may seems simple to most of you but i need a good explanation of covering this format of binary to decimal "0110 1010". Im having trouble finding a good tutorial. I would like a detailed explanation of method of how to translate it. Thank you.

Link to comment
Share on other sites

In code, or on piece of paper?

 

Algorithm of conversion of any base-x system could be:

(loop start)

get modulo of number.

push it on stack (FILO).

divide number by the same base.

(loop end) repeat until number is not 0.

Then pop up elements ("digits") from stack and show to user after appropriate conversion (like elements with 16 > n >= 10 replace by 'a' to 'f' in the case of hexadecimal system).

 

Edited by Sensei
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.