1. ## late night coding

Allright so I know the error in my code is a logic error. I"m not very good at math, and even if i were i'm not sure i would be able to translate it to C.

The problem. Daphne earns 10% simple interest every year and Deirdre earns 5% compound interest. After how many years will Deirdre's balance exceed Daphne.?

I coded it the first time and every thing seemed fine. Then I realised deirdre had to have compound interest. I went through it a couple times, but it might as well be obfuscated code for me at this hour. What if anything Am i doing wrong, becaue my answer can't be right, is it?
Code:
```/* the CompoundINTREST.c */

#include <stdio.h>
#define AMNT 100.00

int main(void)

{

float daphneBAL, deirdreBAL, interest;
int year;

/* Format the screen */

printf("Year     Daphne\t  Deirdre\n");

/*calculate interest */

deirdreBAL = 100.00;
for ( year = 1; year <= 10; year++){
daphneBAL = ( AMNT * 0.10 + AMNT) * year;  /* ten percent simple interest */

/* deirdre gets compounded interest */

interest = ( AMNT * 0.05 + AMNT) * year;
deirdreBAL += interest;

printf("%3d  %10.2f  %10.2f", year, daphneBAL, deirdreBAL);
if ( deirdreBAL > daphneBAL ){  /* is deirde beating daphne yet */
printf("\nDeirdre just beat daphne\n");
break;
}
printf("\n");
}

getchar();
return(0);

}```

Thank you (C board);

2. Your maths is screwed basically,

Code:
```    /*calculate interest */
daphneBAL  = AMNT;
deirdreBAL = AMNT;
for (year = 1; year <= 50; year++) {
daphneBAL  += AMNT * 0.10;    /* ten percent simple interest */
deirdreBAL *= 1.05;           /* 5 percent compounded */
printf("%3d  %10.2f  %10.2f", year, daphneBAL, deirdreBAL);
if (deirdreBAL > daphneBAL) {   /* is deirde beating daphne yet */
printf("\nDeirdre just beat daphne\n");
break;
}
printf("\n");
}```

3. Thanks salem,

I'll have to work on that.

Do you have any good links or tutorials on mathamatical thinking as it applies to programming and computers. I've been searching google but to no avail. Or is discreete mathamatics the way to go - aside from arithmatic, and algebra and linear?

Thanks.