Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-15-2011, 07:49 AM
|
#1
|
Member
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 262
Rep:
|
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.
|
|
|
10-15-2011, 09:55 AM
|
#2
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852
|
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? 
|
|
|
10-15-2011, 10:14 AM
|
#3
|
Member
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 262
Original Poster
Rep:
|
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 ?
|
|
|
10-15-2011, 10:47 AM
|
#4
|
Senior Member
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379
Rep: 
|
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.
|
|
1 members found this post helpful.
|
10-15-2011, 11:13 AM
|
#5
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep: 
|
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.
|
|
|
10-15-2011, 11:20 AM
|
#6
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,375
|
Which specific decimal number does AEP952708 convert to?
|
|
1 members found this post helpful.
|
10-15-2011, 11:38 AM
|
#7
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
|
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.
Last edited by theNbomr; 10-15-2011 at 11:40 AM.
|
|
|
10-15-2011, 05:08 PM
|
#9
|
Senior Member
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
|
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.
|
|
|
10-15-2011, 05:22 PM
|
#10
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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. 
|
|
|
10-15-2011, 08:53 PM
|
#11
|
Senior Member
Registered: May 2005
Posts: 4,481
|
Quote:
Originally Posted by frieza
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 11:19 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|