#include<stdio.h>
#include<math.h>
int main(){
float d = 300000.0, p = 6000.0, r = 0.01, m;
m = log10(p/(p-d*r)) / log10(1+r);
printf("m=%6.1f\n",m);
printf("检验m对第二位小数的四舍五入:");
printf("m=%6.2f\n", m);
return 0;
}
引入math库#include<math.h>
然后使用math库中的log函数进行公式编写
很喵