7. Deposit preferred embodiment primary series

Best Deposit Scheme

Problem Description
assume one-year bank monthly interest rate of 0.63% Lump of now there is someone in the hands of a sum of money
he intends to remove at the end of each year in the next five years just to take complete 1000 yuan to fifth year
Please figure it save money how much should be credited
problem analysis
meaning of the questions, can be calculated forward from the fifth year, it is known to remove the 1000 yuan this fifth year when you can just take complete and therefore the end of the fifth year at the end of each year in the next five years will remove 1000 yuan can calculate the number of early fifth year in the bank's money is stored:
beginning deposits 5 years = 1000 / (12 * 1 + 0.0063)
...
number of deposit early 4th = (V +1000 early deposit number) / (1 + 12 0.0063)
....
the beginning of the first deposit number = (the beginning of the second year deposit number +1000) / (1 + 12
0.0063)
algorithm design
using loop, loop 4 times, each time in the last cycle basis with 1000 and then divided by (1 + 12 * 0.0063)

/* !< use c */
#include <stdio.h>
#include <stdlib.h>


int main()
{
    int i;
    double money = 0.0;

    for (i = 0; i < 5; i++) {
        money = (money + 1000) / (1 + 0.0063*12);
    }
    printf("应存入的钱数: %0.2f\n", money);
    return 0;
}

Guess you like

Origin www.cnblogs.com/xuzhaoping/p/11484507.html