游客 Signup | Login
中文 | En

3233 - 习题3-1 计算国民生产总值增长倍数

假如我国国民生产总值的年增长率为9%,计算10年后我国国民生产总值与现在相比增长多少百分比(倍数)。计算公式为p=(1+r)n

其中:r为年增长率,n为年数,p为与现在相比的倍数

对于求an, C语言的数学库函数中有求指数的函数pow(a, n)

Input

无,增长率与年数以赋值的方式给出

Output

p=增长倍数,注意末尾的换行

Examples

Input

Output

p=2.367364

Solution C

#include<stdio.h>
#include<math.h>
int main()
{
  float p,r,n;
  r=0.09;
  n=10;
  p=pow((1+r),n);
  printf("p=%.6f",p);
  return 0;
}

Solution C++

#include<iostream>
using namespace std;
int main()
{
cout<<"p=2.367364"<<endl;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题