I have been trying for many hours to get this to work, but alas no success. i have about 6 programs to write and they all build off of this one so I'm stuck. I could really use some help please. this is my first post btw in case I am missing some sort of forum guidelines.
here is the program scenario:
Suppose you invest $100.00 at an interest rate of 10% per year. The interest is computed at the end of each year, and is added to your account (i.e., the interest is compounded yearly). Print what the account value will be each year for 20 years. Use data type double. Do not use the pow function.
This is what I have so far:
Code:
/* 20 yr interest */
#include <stdio.h>
/* function main begins program execution */
int main( void )
{
double amount;
double amount2;
double principal = 100.00;
int year;
double rate = .10;
printf("Year\tAmount on deposit ($)\n");
for(year=1; year<=20; year++)
{
amount = principal * rate;
amount2 = (amount + principal) * rate;
printf("%4d\t\t%8.2lf\n", year, amount2);
}
return 0; /* indicate that program ended successfully */
} /* end function main */