I have number like 230.
And 50 is always the limit.
I want to get the following data:
I should get four 50’s and its exist number that is less than 50.
example 2.
Number = 400
I should get
[50,50,50,50,50,50,50,50]
example 3:
Number = 110
I should get
[50,50,10]
3
Answers
Javascript
This is a basic way of doing it using
%
which is the modular operator.$ node fifties.js
[
50, 50, 50, 50,
50, 50, 40
]