The C log10 function is one of the C Math Functions used to calculate the logarithmic value of a number with base 10. The syntax of the C math log10 function is
double log10(double number);
C log10 Function Example
The math log10 Function allows you to find the logarithmic value of base 10. This program will find the log10 value and display the output.
#include <stdio.h> #include <math.h> int main() { printf("\n The Logarithmic Value of 0 base 10 = %.4f ", log10(0)); printf("\n The Logarithmic Value of 1 base 10 = %.4f ", log10(1)); printf("\n The Logarithmic Value of 15 base 10 = %.4f ", log10(15)); printf("\n The Logarithmic Value of 29.3 base 10 = %.4f ", log10(29.3)); printf("\n The Logarithmic Value of -6.32 base 10 = %.4f ", log10(-6.32)); printf("\n The Logarithmic Value of -14.4 base 10 = %.4f ", log10(-14.4)); return 0; }
log10 Example 2
In this C Programming example, we allow users to enter their own values. Next, the program uses the log10 function to find the logarithmic value of the user-given number with base 10.
#include <stdio.h> #include <math.h> int main() { float number, logValue; printf(" Please Enter any Numeric Value : "); scanf("%f", &number); logValue = log10(number); printf("\n Logarithmic Value of %.2f base 10 = %.4f ", number, logValue); return 0; }
Please Enter any Numeric Value : 98.567
Logarithmic Value of 98.57 base 10 = 1.9937