C언어를 이용해서 Log 함수를 계산할 수 있다.
#include <stdio.h>
#include <math.h>
double logB(double x, double base) {
return log(x)/log(base);
}
int main( ) {
double a = logB(3.0, 2.0);
double b = logB(5.0, 2.0);
puts("log3/log2, log5/log2, log3/log2 * log5/log2 = ");
printf("%lf %lf %lf", a, b, a * b);
return 0;
}
'C 언어' 카테고리의 다른 글
| Json 파일을 자막 파일인 srt로 변경 (0) | 2021.01.02 |
|---|---|
| C언어로 자막 파일 수정하기 (0) | 2021.01.02 |
| 매크로함수를 활용한 프로그램 (0) | 2020.12.31 |
| 자료구조 연결 리스트 함수들 정리 (0) | 2020.12.31 |
| 텍스트 파일의 단어를 세는 프로그램 (C 언어 사용) (0) | 2020.12.31 |
댓글