digits

Getting long variable/digit out of a MySQL and 'squashing' it...

Lets say I have a 10,000 digit number in my database... This would be laggy for the viewer if it was echoed out. Is there a way to display only like 100 (the first 100)? Digits? -Either using php, or (Pref.) using MySQL to only get the first 100... ...

Code Golf: ASCII Art number

Possible Duplicate: Code Golf - Banner Generation Post your shortest code to convert a number into a ASCII art digits. Input - Assume that an integer variable called z has already been set containing the number. Output - Print the output to the console. Quality - The lower number of characters, the better. Formatting - Fle...

How to get max digits for the decimal part that non-integer numeric data types can support?

An user must enter a number into a mask-edit control. But that number is, depending on the underlying property, one of any .NET numeric type. For instance. If the property is sbyte, the maximum number the user can enter (with any digit, from 0 to 9) is 99 and the minimum is -99 (because sbyte ranges from -128 to 127). That is something ...

PHP Leftmost digit

Hi, let's say I have a variable containing an integer or a float (since integers might overflow into a float in PHP). I want to run some operation to get the leftmost digit and the rest of the remaining digits. To explain better: <?php $x = NULL; //this will hold first digit $num = 12345; //int /// run operation //outputs //$x...

Recognize the 2 key from the keyboard or from the numpad

Hi, I would like to add keyboard short-cuts to my web application. But for one of them, I need to be able to distinguish between the digits entered with the numpad from the one entered above the qwerty chars (my use case is for French keyboards, so it's azerty, but I don't think it's a problem). I'll combine it with a detection of the ...

Array Division - What is the best way to divide two numbers stored in an array?

I have two arrays (dividend, divisor): dividend[] = {1,2,0,9,8,7,5,6,6}; divisor[] = {9,8}; I need the result (dividend/divisor) as: quotient[] = {1,2,3,4,5,6,7}; I did this using array subtraction: subtract divisor from dividend until dividend becomes 0 or less than divisor, each time incrementing quotient by 1, but it takes a...

Sort N numbers in digit order

I found out about this question recently. Given a N number range Eg. [1 to 100], sort the numbers in digit order (i.e) For the numbers 1 to 100, the sorted output wound be 1 10 100 11 12 13 . . . 19 2 20 21..... 99 This is just like Radix Sort but just that the digits are sorted in reversed order to what would be done in a normal Radix...

in python how do I convert a single digit number into a double digits string?

So say i have a = 5 i want to print it as a string '05' ...

regex excel: how do i remove ALL numbers from a cell?

i cells that look like this: one per line: Duffy,John: 'Heritage: Civilization and the Jews'- Fanfare & Chorale,Symphonic Dances + Orchestral Suite. Bernstein,'On the Town' Dance Episodes. Royal Phil./R.Williams Lilien,Ignace 1897-1963: Songs,1920-1935. Anja van Wijk,mezzo & Frans van Ruth,piano Hindemith,Trauermusik. Purcell,'Fairy Que...

How can I safely and quickly extract digits from an int ?

We currently have some code to extract digits from an int, but I need to convert this to a platform without snprintf, and I am afraid of a buffer overrun. I have started to write my own portable (and optimized) snprintf but I was told to ask here in case someone had a better idea. int extract_op(int instruction) { char buffer[OP_L...

How do I generate a random n digit integer in Java using the BigInteger class?

I am unsure about how to generate a random n digit integer in Java using the BigInteger class. ...

How can you get the number of digits contained in a double?

I'm trying to get the number of digits in the following double value: 56.46855976 without using converting it to a string (and simply replacing the "." with a ""). Anybody got any ideas? Cheers ...

strange unwanted three digit code printouts from caesar cipher

hi all I'm having problems with my code. the cipher actually works its just I get some odd three digit codes separated with slashes any help would be greatly appreciated heres my code the codes look like this but have random numbers /354/233/645/810/236 #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include...

javascript, best way to tell if a val is a single digit

whats the best way to tell if a value in javascript is a single digit. Ive been doing something like var valAsString = '' + val; if (valAsString.match(/\d/) {} clarification: I mean one of 0,1,2,3,4,5,6,7,8,9 Also, should what I have work? Im surprised how many different ways people are coming up with for this. ...

c ++ digits after decimal point.

Hey I have a float number for example 12.12123 Is there a function which would display only number with 2 digits after decimal point 12.12 ? Here is the code: y1 = ( c1 - (a1 * x)) / b1; y2 = ( c2 - a2 * x) / b2; if (y1 == y2) cout << "The same"; so if the y1 = 1.001 and the y2 = 1.002 they do not appear as the same. I tried to...

MySQL:set result two digits behind comma

i have some formula: CONCAT((SUM(X.lot_qty)-SUM(X.reject))/SUM(X.accept)*100,'%') AS Acceptance but i get result like: 100.0000% how to get result as 100.00%? ...

repeating back digits?

Hi, I'm trying to use C++ to grab 5 digits from the user and repeat it back to the user. Unfortunately, the closest I have come to that is by repeating it back backwards... any help here? ...

Objective C- How to add digits in a number?

How do I add the digits in a particular number for example if the number is 3234 the result should be 3+2+3+4 = 12? ...