#include <stdio.h>
#include <math.h>
int main() {
// 定义年增长率r和年数n
double r = 0.10; // 年增长率为10%
int n = 10; // 年数为10年
// 计算倍增因子P
double P = pow(1 + r, n);
// 计算增长的百分比
double growth_percentage = (P - 1) * 100;
// 输出结果
printf("10年后我国国民生产总值与现在相比增长了 %.2f%%\n", growth_percentage);
return 0;
}
【c语言】算10年后我国国民生产总值与现在相比增长多少百分比。计算公式为:P=(1+r)n,r为年增长率,n为年数,P为与现在相比的倍数。Pow(),math
最新推荐文章于 2024-12-26 15:47:29 发布