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
1 answer

Count number (0-9) occurrences in a string from a txt file in C

Count number (0-9) occurrences in a string from a txt file in C I created the part that reads the string from the file and saves it as the variable "line" My idea is to create a table with 10 elements that at the beginning are 0 and for example if I…
designalix
  • 65
  • 4
2
votes
2 answers

Remove digits between two fullstops

Is there any way to remove digits between two full stops in python? eg: Input 1: "remove 1 from .1." Output 1: "remove 1 from." Input 2: "XYZ is a student.2. XYZ is a boy.3. XYZ is smart." Output 2: "XYZ is a student. XYZ is a boy. XYZ is…
2
votes
1 answer

grep Howto extract a link only from a webseite

I was searching a lot, but nothing really helped me to find a solution to my question. I am still learning regex and have some success, but in this case I can't get to the solution I want. I am writing scripts to actualize installation packets for…
2
votes
3 answers

Divide number into digits and save them in list (array) using python

I want to divide number into digits and save them in list (or array) in python. So firstly I should create list like dig = [0 for i in range(10)] and then i = 0 while num > 9: dig[i] = num % 10 i += 1 num /= 10 dig[i] = num But I…
Templar
  • 1,843
  • 7
  • 29
  • 42
2
votes
2 answers

how to check if the value contains symbols

i want ask to you ( in python) how I can check if user enter symbols (!,@,#,$,%,^,&,*) example if user enter this (1234%67890) in var (number) I want compiler show ( number invalid try again ) number from 10 digit I hope you understand what I…
alwagdani
  • 21
  • 2
2
votes
0 answers

Digit Dynamic Programming Problem For Sum of Numbers

I want to find the sum of all the positive integers in the range [1, N] with a given digit sum d. For example, if n = 100 and d = 7, the answer will be 7 + 16 + 25 + 34 + 43 + 52 + 61 + 70 = 308. Following code can be used to count the numbers in…
user2784016
  • 179
  • 1
  • 7
2
votes
3 answers

Find the position of a max on a number

I have C program that needs to find the position of a number. It goes like this: From standard input we enter unknown number of number that are positive. The numbers have maximum of 5 digits, we read new numbers till the user enters a value that is…
itmemilan
  • 331
  • 4
  • 17
2
votes
1 answer

How to get value of clicked button in calculator

I have multiple buttons containing different values And I want…
2
votes
0 answers

How do you expand a decimal with 0 or only 2 digits to 4 digits (#.0000)?

I have decimals by different sources with different digits. I need all of them like: #.0000 (with 4 digits) decimal amountOrigin = 12345678.00; //automatically two digits via Newtonsoft.JsonConvert() decimal amountByOwn = 1234567.0000; //I try to…
Froschkoenig84
  • 566
  • 4
  • 13
2
votes
3 answers

Remove digits from a list of strings in pandas column

I have this pandas dataframe 0 Tokens 1: 'rice', 'XXX', '250g' 2: 'beer', 'XXX', '750cc' All tokens here, 'rice', 'XXX' and '250g' are in the same list of strings, also in the same column I want to remove the digits, and because it with another…
rnv86
  • 790
  • 4
  • 10
  • 22
2
votes
3 answers

R shows too few digits

I wanted to calculate that term: (21000*(1.022^7-1))/(1.022-1) R tells me, it's 157065.7. This was my answer to a task that I had to solve. It was stated that this answer is not correct, the correct answer should be 157065.67. Then I calculated…
TobiSonne
  • 1,044
  • 7
  • 22
2
votes
1 answer

What is the problem of np.convolve with 10**9?

Good morning, when I use the below code, I get a wrong result import numpy as np print(np.convolve([10**9], [ 10**9])) I am getting:-1486618624 while I should be getting: (10 to the power of 9) * (10 to the power of 9) = (10 to the power of 18) How…
Francesco
  • 111
  • 9
2
votes
2 answers

How to find the numbers in the thousands, hundreds, tens, and ones place in DELPHI for an input number? For example: 155 has 5 ones, 5 tens, etc

var iNum, iNumHun, iNumTens, iNumOnes : Integer; begin iNum := StrToInt(edtInput.Text); iNumHun := iNum DIV 100; iNumTens := iNum DIV 10; iNumOnes = iNum DIV 1;
Renier
  • 21
  • 1
2
votes
3 answers

How to modify a float to display at least n digits

In bash, how can I modify a float so that the part coming before the dot is having at least two digits? I want to make numbers in Column A be displayed as in Column B: A (Current) B (Desired) ----- ------ 8.456 08.456 4.19 …
nino
  • 554
  • 2
  • 7
  • 20
2
votes
4 answers

Find the Kth smallest number whose digits have a sum of 10

Looking for alternative algorithms Below are the ones l have made but are being flagged as incorrect by the Online Judge on a coding website. After declaring variable of int data type k, l received an input from the console using cin(). Since the…