In a small town, the population is p0 = 1000 at the beginning of a year. The population regularly increases by 2 percent per year and moreover 50 n...
For further actions, you may consider blocking this person and/or reporting abuse
JavaScript recursion
Lets have a Go, shall we?
population.go
population_test.go
Simple python solution:
I implemented the same but using recursion, check if you want :)
Here is the PHP code snippets:
Swift solution :
Elixir variant :)
Elm
Playground
Ellie App.
In C
A python one using recursion :
Ruby
JS
By the way, I've just noticed that the author of this challenge is g964, not Becojo. It might be good to fix that in the post.
function nbYear(p0, percent, aug, p) {
// your code
let n = 0;
while(p0 < p) {
p0 = p0 + Math.round(p0 * (percent/100)) + aug;
n ++;
}
return n;
}