You are here

log10

log10 function returns common logarithm (base is 10) of a number.

Declaration: double log10(double number);

C programming code for log10

  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.   double n, result;
  7.  
  8.   printf("Enter a number to calculate it's log(base is 10)\n");
  9.   scanf("%lf", &n);
  10.  
  11.   result = log10(n);
  12.  
  13.   printf("Common log of %.2lf = %.2lf\n", n, result);
  14.  
  15.   return 0;
  16. }

Output of program:
log10 math.h C programming