What is log10 in C?
The log10 function allows users to calculate the
Library
The log10 function is accessible from the math.h library.
Syntax
double log10(double x)
Parameters
The function takes one parameter, a number for which a common logarithm is needed.
The number needs to be positive (greater than
0) as the logarithm of negative numbers, and zero, are undefined.
Return value
The log10 returns the common logarithm of the number given as a parameter. The returned number is of double the datatype.
Code
#include <stdio.h>#include <math.h>int main(){double number, log_of_number;number = 100;log_of_number = log10(number); //taking the common log of numberprintf("log10(%lf) = %lf\n", number, log_of_number);// log10 of number will be printed}
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved