【C语言】n年后国民生产总值比现在增长的倍数

青乌

关注

阅读 122

2022-12-01

【C语言】n年后国民生产总值比现在增长的倍数_#include

​#include <stdio.h>

#include <math.h>

int main()

{

float r=0.07,p;       //国民生产总值增长率r,与现在的倍数p;//  

int  n;         //n表示年份//  

printf("Please enter year:\n");

scanf("%d",&n);

p = ((pow((1+r),n))+0.005)*100;    //四舍五入化为百分比形式//  

printf("After %dyears the GNP is now %.2f%%",n,p);

return 0;

}

精彩评论(0)

0 0 举报