Header file:
math.h
Synopsis:
double log10(double x);
Description:
Returns the value of base 10 logarithm of x.
log10 function C example:
#include<stdio.h>
#include<math.h>
int main() {
double input, res;
printf("Enter your input:");
scanf("%lf", &input);
res = log10(input);
printf("log(%lf) = %lf\n", input, res);
return 0;
}
#include<math.h>
int main() {
double input, res;
printf("Enter your input:");
scanf("%lf", &input);
res = log10(input);
printf("log(%lf) = %lf\n", input, res);
return 0;
}
Output:
jp@jp-VirtualBox:~/cpgms/math$ gcc log10.c -lm
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:10
log(10.000000) = 1.000000
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:10
log(10.000000) = 1.000000
No comments:
Post a Comment