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

php match number for first 2 digits and length

I would need to check in php if the number has 10 digit length and the first 2 digits need to be 09 and check for no space too please? sample true number = 0912345678 Thanks Ramin
Ramin Rabii
  • 359
  • 4
  • 14
-2
votes
1 answer

KSH remove digits from number precision

I am trying to compare 2 log files in a ksh script that look like log1: 10100 951 5 20150318 20150430 10101 11950 0 20150323 20150630 10102 285933 1 20150128 20150430 10041 57007 3.53 20150128 20150430 log2 10100 951 5.0000 20150318…
Lara
  • 1
  • 1
-2
votes
1 answer

How to Compute Digits of factorial in best efficient

I know the way to compute digits of factorial in the following manner. let digits of n! to be found. temp = 0.0; for(i = 1; i <= n; i++){ temp += log(i); } result = (int)temp; result++; i'm here looking for more efficient way to count digits of…
mhkm
  • 1
  • 2
-2
votes
2 answers

Date in the data base comes in 10 digits

I am so new in PHP / MySQL. I did this tutorial online: Members Area System in php mysql - members users system area log…
user2823725
  • 121
  • 6
-2
votes
2 answers

Reversed Digits Histogram: Given one integer N, for each digit from the end of N, print a line of stars which has number of stars equal to that digit

Given one integer N, for each digit from the end of N, print a line of stars which has number of stars equal to that digit C++ Example Input: 2863 Example Output: *** ****** ******** ** my code work in inputs like 12345,..,etc. but not work in…
-2
votes
1 answer

wrong result in adding huge numbers in c

I want to add some huge numbers which I am gonna input from the keyboard. However I want to input them as a string. I've tried a different way with the ASCII which was written in another answer but it doesn't seem to work. Anyway here is my…
George David King
  • 201
  • 3
  • 4
  • 10
-2
votes
7 answers

Sum of digits of a number in C#?

I am trying to write a code that sums the digits of a number and it should work, but I can't find where I am doing it wrong, I have a working code in Python for this and I tried to do it the same way in C# but.. Here are the two codes Python: number…
Darkbound
  • 3,026
  • 7
  • 34
  • 72
-2
votes
3 answers

How to get the digits from a substring in powershell

I have a string which contains a duration in milliseconds, and I want to get the duration. For example: $a="Group policy waited for 904 milliseconds for the network subsystem at computer boot." How do I get the duration of "904" in the above…
SA345
  • 251
  • 1
  • 3
  • 3
-2
votes
1 answer

How to determinate the amount of digits in integer in C++?

I'm trying to determinate the amount of digits in integer in C++ and so far I've tried the following methods: 1. unsigned GetNumberOfDigits (unsigned i) { return i > 0 ? (int) log10 ((double) i) + 1 : 1; } 2. int length_of_int(int input){ …
user2699298
  • 1,446
  • 3
  • 17
  • 33
-2
votes
1 answer

How to use "tr" to replace a digit in a number

My input file contains some series of commands for a number for eg. 13287 13288 13289 I want the following output in all the file. 13281 13282 13283 I am using the following command saved in a script file as I pass the first four digits as…
Mohit Kumar
  • 46
  • 1
  • 2
  • 11
-3
votes
1 answer

if the character is a numeric digit, prints its name in text (e.g., if input is 9, output is NINE)

enter image description here in the image please see the option c . I need a program in python. enter image description here I was trying to print number in word but I didn't get successful. I want a answer in python.
Anand
  • 7
  • 3
-3
votes
4 answers

T-SQL how to add trailing zeros to a string varchar

My number needs to be 8 digits long, however If its less than 8 digits long I need to add trailing zeros to the it. Example: 1234 Desired result: 12340000 I tried this at first: DECLARE @YourNumber VARCHAR(8)=1234567; SELECT DISTINCT…
Rafa N
  • 1
  • 1
-3
votes
3 answers

Breaking down a number into digits - C

I'm trying to create a program that breaks down a number into its component digits. The code I've written so far is as follows: #include int main() { int num; int digits; int count = 1; printf("Insert a positive number: "); do { …
user13716820
-3
votes
3 answers

check if all the digits of the given number are different

I want to create a 4-digit number between 1000 and 10000 with different digits, but I am a bit inexperienced as I am new to this stuff. Can you help me? import random number = random.choice(range(1000,10000)) print(number)
hamsi
  • 3
  • 2
-3
votes
1 answer

reduction of complexity numbers procedure

I'm looking for a solution to my problem if I have numbers var first = 14:1 var next = 13:8 therefore, the console should give a result console.log(first_result) // 141 console.log(next_result) // 141 and I want the numbers counted like 141 in…