假如我国国民生产总值的年增长率为7%,计算10年后我国国民生产总值与现在相比增长多少百分比

假如我国国民生产总值的年增长率为7%,计算10年后我国国民生产总值与现在相比增长多少百分比

#include <stdio.h>
#include <stdlib.h>
int main()
{
	double p, r;
	p = 1.0;
	scanf("%lf", &r);
	for (int i = 0; i < 10; i++)
	{
		p *= (1 + r);
	}
	printf("%lf", p*100);
	system("pause");
	return 0;
}

答案
假如我国国民生产总值的年增长率为7%,计算10年后我国国民生产总值与现在相比增长多少百分比

发布了8 篇原创文章 · 获赞 0 · 访问量 66

猜你喜欢

转载自blog.csdn.net/qq_36711295/article/details/105340383