LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 10-15-2011, 07:49 AM   #1
drManhattan
Member
 
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 262

Rep: Reputation: 1
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.
 
Old 10-15-2011, 09:55 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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?
 
Old 10-15-2011, 10:14 AM   #3
drManhattan
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: Reputation: 1
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 ?
 
Old 10-15-2011, 10:47 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
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.
Old 10-15-2011, 11:13 AM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
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.
 
Old 10-15-2011, 11:20 AM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,200

Rep: Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307
Which specific decimal number does AEP952708 convert to?
 
1 members found this post helpful.
Old 10-15-2011, 11:38 AM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 10-15-2011, 03:00 PM   #8
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by drManhattan View Post
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 .
 
Old 10-15-2011, 05:08 PM   #9
frieza
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

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
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.
 
Old 10-15-2011, 05:22 PM   #10
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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.
 
Old 10-15-2011, 08:53 PM   #11
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by frieza View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert hex to decimal inside script with awk philipz Programming 11 12-14-2010 08:19 PM
Identify and explain the major number, minor number, and revision number in Linux... turbomen Linux - Newbie 1 11-16-2010 02:48 AM
i need to split a decimal number in such a way that each unit is between 1 and 26 anurupr Programming 8 03-07-2010 10:36 PM
grep regex number decimal capital letter casperdaghost Linux - Newbie 4 08-22-2009 06:32 AM
Have problem converting a decimal number to octal Linh Programming 4 05-20-2004 03:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration