代码如下,如有帮助,请采纳一下,谢谢。
#include <stdio.h>
#include <math.h>
int main()
{
double p = 6000;
int d = 300000;
double r = 0.01;
double m = log(p/(p-d*r))/log(1+r);
m += 0.05; //对第二位小数四舍五入
printf("m=%.1f\n",m);
return 0;
}
c语言的math.h算法库里有log函数的