Category "numbers"

Getting table name from cell selection in Apple Numbers using Javascript for Automation (JXA)

I'm trying to convert this Applescript to Javascript for Automation. Is there anyone who can help to write the line bellow in Javascript for Automation? set thi

How could I call hundreds in python?

When I split certain numbers into "ones" and "tens" in python, like that (98) we code >>> num = 98 ones = num % 10 tens = num // 10 print(ones) = 8

Turkish Identity Number Verification

How can I make sure that the given text is Turkish Identity Number? I have seen js version here and phthon version here Also, posted a question couple of days

Why does JavaScript handle the plus and minus operators between strings and numbers differently?

I don't understand why JavaScript works this way. console.log("1" + 1); console.log("1" - 1); The first line prints 11, and the second prints 0. Why does Jav

C# - Random Generator exclude last number from Array

I've just started my first little project in C# and with WinForms and I am stuck on this one feature for a few days now.. I have an Array with about 60 PictureB

Can I Set The Number Of Threads From An External FIle in Apache Jmeter?

I have many JMeter scripts that are testing different scenarios and I want to create a configuration file for some common values across my scripts, so I will no

How can I format this number correctly using PHP?

I have a number with numbers after the decimal but for some reason when formatting it, the last two decimals are always zero. For example a price is 154,95 as

Elegantly calculate the minimum and maximum of a number array simultaneously

In Javascript, given a simple number[] array, is there an elegant way to calculate the minimum and maximum values simultaneously, or return undefined if the arr

Fastest way to cast a float to an int in javascript?

Let's say I have x = 12.345. In javascript, what function floatToInt(x) has the fastest running time such that floatToInt(12.345) returns 12?

How to generate random binary numbers 0 or 1 with length of N and with option to control the probability of having 0 or 1?

I want to generate random binary numbers (0 or 1) having N length size. The tricky part is that, It should be able to control the probability of having either m

Why does the html input with type "number" allow the letter 'e' to be entered in the field?

I have the following html5 input element: <input type="number"> Why does this input allow for the character 'e' to be entered in the input field? No othe

Javascript. Reduce an array by adding only odd numbers. Javascript returns NaN when I use %2 on a number with if [duplicate]

I am trying to sum all odd numbers of an array. The following method does not work and returns NaN. Could someone explain me why? I found a wo

Given a sequence of integers, return the sum of all the integers that have an even index, multiplied by the integer at the last index

This is my solution and it passes some of the tests, but not all of them. Can anyone help me and explain why? Thank you :) function evenLast(numbers) { let su

How to extract prime numbers from a fibonacci series in C++?

Please help my code is as follows. I have found out the Fibonacci series within a range successfully but I am finding it difficult to extract the prime numbers

Converting words to numbers

I have problem converting words into numbers like Input: Five Thousand Six Hundred Thirty two Output: 5632 How can I do this?

Prevent negative inputs in form input type="number"?

I want to restrict user input to positive numbers in an html form. I know you can set min="0", however it is possible to bypass this by manually entering a ne

How to separate range of integers into two equal parts

I have an array of integers like this one int [] num = {5, 8, 1, 1, 2, 3, 2} and I want to divide it into 2 parts, so that the total of 2 sets will be as equ

How can I extract a number from a string in JavaScript?

I have a string in JavaScript (e.g #box2) and I just want the 2 from it. I tried: var thestring = $(this).attr('href'); var thenum = thestring.replace( /(^.+)(\

Create a unique number with javascript time

I need to generate unique id numbers on the fly using javascript. In the past, I've done this by creating a number using time. The number would be made up of t

Postscript: how to convert a integer to string?

In postscript , the cvs *operator* is said to convert a number to a string. How should I use it ? I tried : 100 100 moveto 3.14159 cvs show or 100 100 movet