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?