//提示一下,log2(x)=log(x)/log(2) 换底公式
#include#include "stdio.h"
#include "math.h"
double logMath(double x)
{
double n;
n = log10(x)/log10(2);
return n;
}
int main(int argc, const char * argv[]) {
// insert code here...
double n;
double x;
printf("请输入!\n");
scanf("%lf",&x);
n = logMath(x);
printf("计算结果是:%.2f\n",n);
return 0;
}