I have got the following program to compare two accounts, one with simple interest and the other with compound interest and I am sure that my result of 2.147 billion years is wrong, so could someone point out an error to me?
#include <stdio.h>
int main(void) {
int simp_acct = 100, comp_acct = 100, years;
simp_acct += 10; /*simple interest*/
comp_acct *= .05; /*compound interest*/
while(comp_acct < simp_acct) {
simp_acct += 10;
comp_acct *= .05;
years++;
}
printf("Compound interest at .05%% beats simple interest at 10%% ");
printf("after %d years.\n", years);
return 0;
}