按年利率R%存入本钱X,存入P年后的本利合计为Y=X*((100+R)/100)^P,求Y的值。
解题思路:
pow函数:y的x次方
#include<stdio.h>
#include<math.h>
int main()
{
float R,X,P,Y;
scanf("%f %f %f",&R,&X,&P);
Y=(100+R)/100;
Y=pow(Y,P);
Y=Y*X;
printf("%.2f",Y);
return 0;
}
按年利率R%存入本钱X,存入P年后的本利合计为Y=X*((100+R)/100)^P,求Y的值。
解题思路:
pow函数:y的x次方
#include<stdio.h>
#include<math.h>
int main()
{
float R,X,P,Y;
scanf("%f %f %f",&R,&X,&P);
Y=(100+R)/100;
Y=pow(Y,P);
Y=Y*X;
printf("%.2f",Y);
return 0;
}