Answer the question
In order to leave comments, you need to log in
There is a set of numbers, how to determine that they end with a certain number?
for example there are some numbers: 54, 3, 25, 47 find out which one ends with 4
Answer the question
In order to leave comments, you need to log in
arr.filter(n => n % 10 === 4)
or
or
or
arr.filter(n => /4$/.test(n))
arr.filter(n => ''.endsWith.call(n, 4))
(`${arr}`.match(/\d*4(?=\D)/g) || []).map(Number)
int n = 4;
int numbers[n] = {54, 3, 25, 47};
for (int i = 0; i < n; i++) {
if (numbers[i] % 10 == 4) {
cout << numbers[i] << endl;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question