假设银行一年整存零取的月息为1.875%(年息为12*1.875%,年息按复利计算),现在某人手头有一笔钱,他打算在今后5年中,每年年底取出1000元作为孩子来年的教育金,到第5年孩子毕业时刚好取完这笔钱,请采用逆推法编程计算第1年年初时他应存入银行多少钱。
**输出格式要求:“He must save %.2f at the first year.\n”

#include<stdio.h >
#define a 12*1.875/100//利息
int main()
{
	int i = 0;
	double x = 0;
	//从公式上看就是:(((x*(1*a)-1000)*(1+a)-1000)*(1+a)-1000)...=0
	while (i < 5)
	{
		x = (x + 1000) /(1+ a);//不要忘了1
		i++;
	}

	printf("He must save %.2f at the first year.\n",x);
	return 0;
}

更多推荐

假设银行一年整存零取的月息为1.875%(年息为12*1.875%,年息按复利计算),现在某人手头有一笔钱,他打算在今后5年中,每年年底取出1000元作为孩子来