Home >>C Math Functions >C math log10() function
C math log10() function is used to return the common logarithm (base-10 logarithm) of any given input argument x. This function takes a single argument and returns a value of type float. This function is defined in <math.h> header file.
Syntax:double log10(double x)
x−It is the floating point value.
Here is an example of log10() function:
#include <stdio.h>
#include <math.h>
int main ()
{
double x, ret;
x = 100;
/* finding value of log1010000 */
ret = log10(x);
printf("log10(%lf) = %lf\n", x, ret);
return(0);
}
#include <stdio.h>
#include <math.h>
int main ()
{
double x, ret;
x = 50;
/* finding value of log1010000 */
ret = log10(x);
printf("log10(%lf) = %lf\n", x, ret);
return(0);
}