log10


The log10 function returns the logarithm of x to the base of 10.

Sample Program:

 
/*

Write a program to illustrate log10 math function of C.
*/


#include<stdio.h>
#include<math.h>

main()
{
 double number, result;
 printf("Enter a number to calculate its log (base is 10) ");
 scanf("%lf",&number);
 result = log10(number);
 printf("Common log of %lf = %lf", number, result);
 return 0;
}

Output:

Enter a number to calculate its log (base is 10) 90
Common log of 90.00 = 1.95

Post a Comment

0 Comments