Created
September 12, 2019 17:39
-
-
Save stoneboyindc/e98ebd1f000815ddfec6a70f07a438be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nbYear(p0, percent, aug, P) { | |
// your code | |
var numYears = 0; | |
var currentPop = p0; | |
var convertPercent; | |
if (percent === null || percent == 0) { | |
convertPercent = 0; | |
} else { | |
convertPercent = percent * .01; | |
}; | |
while (currentPop < P) { | |
currentPop = currentPop + (currentPop * convertPercent) + aug; | |
numYears += 1; | |
} | |
return numYears; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment