Questions tagged [digits]

Questions dealing with getting, manipulating, or changing the digits of numbers

Use this tag for questions dealing with getting, manipulating, or changing the digits of numbers. More about digits on wikipedia

1098 questions
2
votes
3 answers

Extracting individual digits from a float

I have been banging my head on this one all day. The C++ project I am currently working on has a requirement to display an editable value. The currently selected digit displays the incremented value above and decremented value below for said…
messenger
  • 614
  • 5
  • 12
2
votes
4 answers

String with 1000 digits, find the biggest 5 digits without an array

I know my code can be simpler and more efficient... My code is supposed to grab the biggest set of 5 digits. It works, except it only is grabbing 3 digits, what would i need to modify to change that? public class thousandDigits { public…
Frank
  • 137
  • 9
2
votes
2 answers

Simpler Way to Get Digit Value From an Integer

I need to breakdown a 3 digit number to get each digit's value. I know how to get the first and last digit's values by using the below: var myInt: Int = 248 print(myInt/100) // first number equals 2 print(myInt%10) // last number equals 8 And I…
Jarron
  • 1,049
  • 2
  • 13
  • 29
2
votes
5 answers

C#. How to count digits entered from input?

This is a code which multiplies numbers, user enters. string x; double t, s = 1; Console.WriteLine("Enter some numbers: "); Console.WriteLine("To finish, press Enter"); while ((x = Console.ReadLine()) != "") { t = Convert.ToDouble(x); s *=…
2
votes
2 answers

VBA rounding values

I am currently working on an excel spreadsheet that has hundreds of different graphs. My macro chooses the y axis values based on the minimum and maximum values of the data series. I am trying to round the min and max to numbers that make sense. For…
jneary19
  • 21
  • 2
2
votes
3 answers

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…
Gelatin
  • 2,393
  • 1
  • 24
  • 29
2
votes
1 answer

How do I make the digits not append after a calculation has just been performed in a jquery calculator?

I have a task to create a calculator in jquery and with the help of the answers I got from the users of this site I managed to almost make it functional. One of the issues left would be that everytime after a calculation has been performed (Eg: 2+5…
Daria M
  • 222
  • 1
  • 11
2
votes
2 answers

Topic 1.6 by Kernighan and Ritchie

I was going through the book "The C Programming language" by Kernighan and Ritchie and I am stuck at a topic. Topic number 1.6 talks about Arrays. In the book, they have included a program that counts the digits, white spaces and other characters.…
codetalker
  • 576
  • 1
  • 6
  • 21
2
votes
3 answers

Shell Extract Text Before Digits in a String

I've found several examples of extractions before a single character and examples of extracting numbers, but I haven't found anything about extracting characters before numbers. My question: Some of the strings I have look like this: NUC320 Syllabus…
Anderb7583
  • 23
  • 3
2
votes
2 answers

How to make this program read double digit integers and triple digits in C?

So this function reads in integers from a file that are separated by spaces and gets the total. It works fine. As long as the numbers are single digit, 1-9. How do I make it read double digit numbers from 1-100 ? Do I make a nested if within the…
Killer_B
  • 61
  • 4
  • 9
2
votes
5 answers

Fastest way to pad a number in Java to a certain number of digits

Am trying to create a well-optimised bit of code to create number of X-digits in length (where X is read from a runtime properties file), based on a DB-generated sequence number (Y), which is then used a folder-name when saving a file. I've come up…
Martin
  • 1,289
  • 3
  • 13
  • 22
2
votes
2 answers

Writing a recursive function that returns the digit with longest consecutive sequence

How do I write a recursive function that that takes an int value and returns the digit with the longest consecutive sequence? For example, f(1122333) returns 3 and f(1223) returns 2 I have no idea how to approach this problem, and I'm kind of new to…
2
votes
2 answers

Unique Combinations of Digits in C

I need to design an algorithm in C to calculate unique combinations of digits for 0 to 1,000,000. For example, when 13 appears, 31 would not be included in this sequence. Can anyone help me find an algorithm to describe this? The first few numbers…
Bucknall
  • 25
  • 1
  • 4
2
votes
1 answer

Split string after n amount of digits occurrence

I'm parsing some folder names here. I have a program that lists subfolders of a folder and parses folder names. For example, one folder could be named something like this: "Folder.Name.1234.Some.Info.Here-ToBeParsed" and I would like to parse it…
mpak
  • 2,458
  • 2
  • 13
  • 19
2
votes
2 answers

C program to print sum of squares of digits of a given number?

I want to write a c program that prints the sum of the squares of a given number. For example, if the given number is 456, the output would be 4^2+5^2+6^2=16+25+36=77. So i have written this code and i want to know why it doesn't work if the user…
ThisSiteSucks
  • 145
  • 2
  • 4
  • 12