LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   convert number (not hex) into Decimal number (https://www.linuxquestions.org/questions/programming-9/convert-number-not-hex-into-decimal-number-908313/)

drManhattan 10-15-2011 07:49 AM

convert number (not hex) into Decimal number
 
Hi

I have to convert to school nr. AEP952708 which is not hex number into decimal number.

Does anyone know how to do this ?
I need exact math explanation.

thx for help.

David the H. 10-15-2011 09:55 AM

Can you give us any context to go with this? I have no idea what that "number" is supposed to be. What does "school nr." mean? Is this supposed to be a course reference number or something?

Unless it's in, what, base26? ;)

drManhattan 10-15-2011 10:14 AM

This must be done as an exercise (e.g. homework) to school.
Basically i need to change nr. AEP952708 into decimal number.

How to do this ?

graemef 10-15-2011 10:47 AM

You first need to understand the problem. Forget the computer, how would you do this by hand?

One guess is that you are being asked to extract the number from the text, so the final result would be 952708. That however is just a guess because I don't know what you need to do and you haven't explained the problem well enough for me to provide you with any more assistance.

anomie 10-15-2011 11:13 AM

Quote:

Originally Posted by graemef
You first need to understand the problem. Forget the computer, how would you do this by hand?

Bingo. There are usually many ways to solve a problem programmatically. But none of those present themselves until you understand how it's done conceptually (the "business logic", if you will).

And please stop abbreviating number (?) as nr. It's just confusing. We are humans, not compilers.

dugan 10-15-2011 11:20 AM

Which specific decimal number does AEP952708 convert to?

theNbomr 10-15-2011 11:38 AM

A few things are germane to your question:
  • Where is the input data coming from?
  • What programming language(s) can you use?
  • How do you distinguish a number as 'decimal'? Values are values, and how you express them doesn't change the value they represent.
  • An example of input data, and the expected resulting output data, along with descriptive text about how the output derives from the input.
As others have alluded to, you need to develop the conceptual basis for the question, and then the solution will probably become obvious.

--- rod.

Sergei Steshenko 10-15-2011 03:00 PM

Quote:

Originally Posted by drManhattan (Post 4499190)
This must be done as an exercise (e.g. homework) to school.
Basically i need to change nr. AEP952708 into decimal number.

How to do this ?

Have you ever thought of actually learning ? Read http://en.wikipedia.org/wiki/Radix -> http://en.wikipedia.org/wiki/Numeral_system .

frieza 10-15-2011 05:08 PM

well since it has a P in it it couldn't POSSIBLY be hex since hex only goes to F (decimal equivalent, 15), the question though is what kind of decimal value are you talking about? ascii values?
that question seems horribly ambiguous, since there is no information provided as to what KIND of number it is in the first place, you can't convert on unknown into something else with any certainty ya know.

PTrenholme 10-15-2011 05:22 PM

Here's an obvious solution: Convert you input to binary, and then express the binary value in decimal notation.

Now all you need to do is figure out what binary number AEP952708 represents. :)

Sergei Steshenko 10-15-2011 08:53 PM

Quote:

Originally Posted by frieza (Post 4499408)
well since it has a P in it it couldn't POSSIBLY be hex since hex only goes to F (decimal equivalent, 15), the question though is what kind of decimal value are you talking about? ascii values?
that question seems horribly ambiguous, since there is no information provided as to what KIND of number it is in the first place, you can't convert on unknown into something else with any certainty ya know.

There can be a radix 36 system - 10 digits + 26 English alphabet letters.


All times are GMT -5. The time now is 05:43 PM.