tags:

views:

63

answers:

3

So, I'm trying to figure out the total amount of return from an investment of £5 with a daily interest rate of 1.01%. Obviously, I am wanting the compound interest rate, so I have this so far:

int main() {

    double i = 500;
    int loop;
    int loopa;
    double lowInterest;
    double highInterest;

    lowInterest = 1.01;
    highInterest = 1.75;

    cout.precision(2);

        for(loop = 1;loop < 1826;loop++) {
            if(i<1001) {
                i = i + ((i / 100) * lowInterest);
            }
            else {
                i = i + ((i / 100) * highInterest);
            }
        }

    cout << fixed << i << endl;

    return 0;

}

I am using 500 to represent the $5 just for personal preference. Am I doing this correctly? I get very strange results - 46592024576.00 for example - that make me think that somewhere I've made an error?

Any suggestions?

+3  A: 

I think you are doing manually what can be done with a simple equation.

http://qrc.depaul.edu/StudyGuide2009/Notes/Savings%20Accounts/Compound%20Interest.htm

A = P(1 + r/n) ^ nt

In this case

p = 5 (amount you invested)
r = 0.0101*365 (annual interest rate)
n = 365 (times compounded/yr)
t = 1  (number of years)

So, just implement the equation.

I may be off on the value of r as it has been years since I took Engineering Economics and I couldn't see how many years so I guessed one.

James Black
Thanks for the forumla, James. I'll keep that for future use.
Saladin Akara
+4  A: 

The figure is about right - if you really were lucky enough to invest $5 at a daily interest rate of 1.01%, you'd end up with close to half a billion dollars after 5 years (a daily interest rate of 1.01% is an annual interest rate of ~ 3800%).

Are you sure you don't mean a daily interest rate of (1.01 / 365) % ?

caf
Thanks caf. Seems that it is right. I couldn't believe the figure when I saw it. Now to see how much of a scam it is! :) Was calculating for a friend is all.
Saladin Akara
Maybe it's an investment denominated in Zimbabwean dollars.
caf
Ha ha! No, wikipedia says that at some point the Zimbabwean dollar had an inflation around 10000000% (ten millions percent, and even more). Even that interest rate wouldn't have been sufficient...
Federico Ramponi
+1  A: 

On a tangential note, your counter loop should start at 0 instead of 1, otherwise it will loop 1825 times instead of 1826.

fylwind