I found the formula on the net that explains the way to compute compound interest a=p(1+r\n)nt where a = amount after time t,
p = principal amount, r = annual interest rate, n = number of time the interest is compounded per year and t = number of years. Do I need to declare another variable? I'm still a little confused because my program below displays the following result:
"Your balance after 2289404 years with an interest rate of Inf would be $-0.000000."
...if I enter a dollar amount deposited of 1500.00 with .07 interest and 20 years for the input.
Description: Displays the balance with interest compounnded annually,
after number of years entered.
# include <stdio.h>
# include <math.h>
void introduction (void);
double ComputeBalance (double a, double r, int n, double t);
/*Allocate memory for data*/
/*Prompt user for data*/
printf ("\nEnter the the dollar amount deposited: $");
printf ("\nEnter the interest rate:");
printf ("\nEnter the number of years:");
/*Processing and display results*/
printf ("\nYour balance after %d years with an\n");
printf ("interest rate of %lf would be"
void introduction (void)
printf ("\nThis program displays the balance with interest,\n");
printf ("compounded annually after number of years entered.");
double ComputeBalance(double a,double r, int n, double t)