DEV Community

Discussion on: Daily Challenge #197 - Population Growth

Collapse
 
aweleczka profile image
Alexander Weleczka

.NET anyone?

int newPopulation = currentPopulation;
newPopulation += (int) Math.Floor(currentPopulation * percentGrowth);
newPopulation += generalFluctuation;

return newPopulation;    

pretty straight forward calculation, checked in a while-loop with a counter.
Got the whole thing over here github.com/AWeleczka/dev-to_daily-... with application and tests. That's also where my solutions are, don't want to spoil this thread any more ;)