C/Math/Log
Содержание
Calculate logarithm base 10: how to use log10
#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;
}
Calculate natural log: how to use log
#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;
}
How to use log
#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;
}
How to use log10
#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;
}