Calculate Money in Bank
Hercy wants to save money in the bank. Initially, he has a certain amount of money that he wants to deposit in the bank. He will deposit this amount every day for a certain number of days.
The bank's rules for calculating interest are as follows:
If it's the ith day (1-indexed) and Hercy has money in the bank, he will receive (i-1) dollars of interest on that day. If it's the ith day and Hercy has no money in the bank, he will not receive any interest on that day. Calculate the total amount of money Hercy will have in the bank after the given number of days n.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)