RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
c语言中如何log函数 c语言log函数怎么用

C语言中log函数怎么使用

x的自然对数用log(x)表示

成都创新互联公司主营加查网站建设的网络公司,主营网站建设方案,重庆APP开发公司,加查h5微信平台小程序开发搭建,加查网站营销推广欢迎加查等地区企业咨询

常用对数用log10(x)表示

#includestdio.h

#includemath.h

int main()

{int i;

for(i=1;i=10;i++)

printf("log10(%d)=%lf\n",i,log10(i));

return 0;

}

C语言中log函数怎么使用?

#include stdio.h#include math.h

void main()

{

double i = 2, j =4;

printf("log2,4 = %f\n",log(j)/log(i));

}

//log函数是以e为底的,还有一个log10以10为底,可以利用logi,j=loge,j/loge,i来算。

C语言中log函数怎么使用呢?

1、C语言中,有两个log函数,分别为log10和log函数,具体用法如下:

2、函数名: log10

功 能: 对数函数log,以10为底

用 法: double log10(double x);

程序示例:

#include math.h

#include stdio.hint main(void)

{

double result;

double x = 800.6872;

result = log10(x);

printf("The common log of %lf is %lf\n", x, result);

return 0;

}

3、函数名: log

功 能: 对数函数log,以e(2.71828)为底

用 法: double log(double x);

程序示例:

#include math.h

#include stdio.hint main(void)

{

double result;

double x = 800.6872;

result = log(x);

printf("The common log of %lf is %lf\n", x, result);

return 0;

}


网站标题:c语言中如何log函数 c语言log函数怎么用
当前URL:http://scyingshan.cn/article/dohosos.html