assuming an interest rate of 11 percent and prints the year, and the corresponding amount,
int two columns.
# include< stdio.h >
#define PERIOD 10
#define PRINCIPAL 5000.00
void main()
{
int year;
float amount, value, inrate;
amount = PRINCIPAL;
inrate = 0.11;
year = 0;
while(year <= PERIOD)
{
printf("%2d %8.2f\n",year, amount);
value = amount + inrate * amount;
year = year + 1;
amount = value;
}
getch();
}
No comments:
Post a Comment