Click here to Skip to main content
15,892,005 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionHow to tokenize a text to determine sentence frequency Pin
nagarsoft26-May-10 23:58
nagarsoft26-May-10 23:58 
AnswerRe: How to tokenize a text to determine sentence frequency Pin
Alan Balkany27-May-10 4:58
Alan Balkany27-May-10 4:58 
AnswerRe: algorithm to get each individual digit from a decimal number (integer) Pin
Richard MacCutchan17-May-10 10:42
mveRichard MacCutchan17-May-10 10:42 
AnswerRe: algorithm to get each individual digit from a decimal number (integer) Pin
Dr.Walt Fair, PE17-May-10 10:45
professionalDr.Walt Fair, PE17-May-10 10:45 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage17-May-10 10:54
ant-damage17-May-10 10:54 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Dr.Walt Fair, PE17-May-10 11:01
professionalDr.Walt Fair, PE17-May-10 11:01 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Anshul R9-Jun-10 4:12
Anshul R9-Jun-10 4:12 
AnswerRe: algorithm to get each individual digit from a decimal number (integer) Pin
Luc Pattyn17-May-10 11:25
sitebuilderLuc Pattyn17-May-10 11:25 
like others have said, a loop containing a modulo 10 and a divide by 10, are what is required. Assembly programming may give access to an instruction that does both operations in one, something higher-level languages typically don't exploit.

You probably don't want any leading zeroes, so you should exit the loop as soon as the quotient is zero, but you still need to output the current remainder, i.e. the test belongs at the bottom of the loop as you want at least one digit.

Keep in mind that the number has to be positive for all of this to work correctly; for negative numbers, you need to "negate" first.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read formatted code with indentation, so please use PRE tags for code snippets.

I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).

GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage17-May-10 12:07
ant-damage17-May-10 12:07 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
molesworth17-May-10 22:21
molesworth17-May-10 22:21 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage18-May-10 9:50
ant-damage18-May-10 9:50 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage18-May-10 11:05
ant-damage18-May-10 11:05 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Luc Pattyn18-May-10 11:28
sitebuilderLuc Pattyn18-May-10 11:28 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage18-May-10 11:41
ant-damage18-May-10 11:41 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Luc Pattyn18-May-10 11:43
sitebuilderLuc Pattyn18-May-10 11:43 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Luc Pattyn18-May-10 13:20
sitebuilderLuc Pattyn18-May-10 13:20 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Tadeusz Westawic24-Jun-10 4:31
Tadeusz Westawic24-Jun-10 4:31 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Luc Pattyn24-Jun-10 4:49
sitebuilderLuc Pattyn24-Jun-10 4:49 
AnswerRe: algorithm to get each individual digit from a decimal number (integer) Pin
CPallini17-May-10 22:42
mveCPallini17-May-10 22:42 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
Luc Pattyn18-May-10 1:23
sitebuilderLuc Pattyn18-May-10 1:23 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
CPallini18-May-10 1:39
mveCPallini18-May-10 1:39 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
theCPkid18-May-10 1:50
theCPkid18-May-10 1:50 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
CPallini18-May-10 1:54
mveCPallini18-May-10 1:54 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage18-May-10 9:01
ant-damage18-May-10 9:01 
QuestionRe: algorithm to get each individual digit from a decimal number (integer) Pin
CPallini18-May-10 10:01
mveCPallini18-May-10 10:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.