[algogeeks] Count number of digits
How can i count the number of digits 0s,1s,2s,3s,... 9s in a number n for example if n=33902 number of 0s=1 number of 3s=2 number of 9s=1 number of 2s=1 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Count number of digits
Mod 10 and divide by 10 to get each digit and then hash that digit to an array and add one to the array entry. Array from 0 to 9 and initialize to each array value 0. Sent from my BlackBerry -Original Message- From: rgap rgap...@gmail.com Sender: algogeeks@googlegroups.com Date: Tue, 18 Jan 2011 03:31:12 To: Algorithm Geeksalgogeeks@googlegroups.com Reply-To: algogeeks@googlegroups.com Subject: [algogeeks] Count number of digits How can i count the number of digits 0s,1s,2s,3s,... 9s in a number n for example if n=33902 number of 0s=1 number of 3s=2 number of 9s=1 number of 2s=1 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Count number of digits
If the number is larger that 64 bits then treat it as a string but do the same thing apart from mod 10 divide bt 10. Sent from my BlackBerry -Original Message- From: rgap rgap...@gmail.com Sender: algogeeks@googlegroups.com Date: Tue, 18 Jan 2011 03:31:12 To: Algorithm Geeksalgogeeks@googlegroups.com Reply-To: algogeeks@googlegroups.com Subject: [algogeeks] Count number of digits How can i count the number of digits 0s,1s,2s,3s,... 9s in a number n for example if n=33902 number of 0s=1 number of 3s=2 number of 9s=1 number of 2s=1 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.