#### Amount Compounded each Year coderinme

Amount Compounded each Year coderinme

Suppose an amount of Rs. 5000/- was deposited in an savings A/c in the year 2000, and suppose that the bank pays 6% interest on the account compounded annually. Letus now write a C program which will print a table showing year and the amount of the account until year 2012.

The formula used to calculate standard compound interest is as follows:

A = P ( 1 + i/100 ) ^n where

A is the final amount that you repay at the end of the loan.

P is the principal amount that you borrow.

i is the the annual rate of interest.

n is the number of years you borrow or invest over.

Before doing this, we should be aware of the fact that for compound interest, amount at the end of each year acts as the principal for the next coming year. Using this fact, we use a while loop for our convenience

```
#include<stdio.h>
int main()
{
int year=2000;
float interest, amount=5000;
printf("\n\tYear\t\tAmount\n\n");
while(year <= 2012)
{
printf("\t%d\t\t%7.2f\n",year,amount);
year++;
interest = 0.06 * amount;
amount = amount + interest;
}
getch();
return 0;
}
```

For more programs in C, visit our C Coder Archives

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme