Skip to content

Instantly share code, notes, and snippets.

@arieljannai
Last active July 3, 2017 17:34
Show Gist options
  • Save arieljannai/583359b6f7b4916f1c7a to your computer and use it in GitHub Desktop.
Save arieljannai/583359b6f7b4916f1c7a to your computer and use it in GitHub Desktop.
Calculate daily interest
// Daily interest calculating.
// >> node interest.js days amount interest
var args = process.argv.slice(2);
var interestDays = function(days, amount, interest) {
for (i = 0; i < days; i++) {
amount = Number(amount) + ((interest / 100) * amount);
}
return amount;
}
console.log('\ntoday payment: ' + interestDays(args[0], args[1], args[2]) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment