C/Math/Log — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
|
(нет различий)
|
Версия 17:20, 25 мая 2010
Содержание
Calculate logarithm base 10: how to use log10
<source lang="cpp">
- include <stdio.h>
- include <math.h>
int main () {
double param, result; param = 100.0; result = log10 (param); printf ("log10(%lf) = %lf\n", param, result ); return 0;
}
</source>
Calculate natural log: how to use log
<source lang="cpp">
- include <stdio.h>
- include <math.h>
int main () {
double p, result; float param = 6.5; result = log (param); printf ("ln(%lf) = %lf\n", param, result ); return 0;
}
</source>
How to use log
<source lang="cpp">
- include <math.h>
- include <stdio.h>
int main(void) {
double val = 1.0; do { printf("%f %f\n", val, log(val)); val++; } while (val<11.0); return 0;
}
</source>
How to use log10
<source lang="cpp">
- include <math.h>
- include <stdio.h>
int main(void) {
double val = 1.0; do { printf("%f %f\n", val, log10(val)); val++; } while (val<11.0); return 0;
}
</source>