log10 Arithmetic function in C Language
- Home
- function in C
- log10 Arithmetic function in C Language
- On
- By
- 0 Comment
- Categories: function in C, pre-define maths function in C
log10 Arithmetic function in C Language
log10 Arithmetic function in C Language
In this tutorial, we will discuss about log10 Arithmetic function in C Language
Description
In the C programming language, the log10() Arithmetic function in C Language returns the logarithm of x to the base of 10
log10(): In C programming Language,log10() function is use to perform calculate natural logarithm
Declaration
The Syntax for the log10() Arithmetic function in the C Language is
double log10(double x);
Parameters or Arguments
x is the parameter or argument of this function used to calculate the logarithm of x to the based of 10
Return value
The log10() function returns the logarithm of value to the base of 10
Required Header
In C Language,the required header file for log10() function is
#include<math.h>
Example
The example shows usage of the log10() function
Program 1
#include <stdio.h>
#include <math.h>
int main()
{
double x,y;
x=1.5;
y=2.5;
printf("log10 value of %f is: %f\n",x,log10(x));
printf("log10 value of %f is: %f",y,log10(y));
getch();
return 0;
}
When we compile above program,it will produce the following result
log10 value of 1.500000 is: 0.176091
log10 value of 2.500000 is: 0.397940
Program 2
#include <stdio.h>
#include <math.h>
int main()
{
//define temporary variable
double value1;
double result;
printf("Enter the number for value1 :");
//get input from user
scanf("%lf",&val1);
//calculate log10
result=log10(val1);
//Display log10 value
printf("log10 value of %lf is: %lf\n",value1,result);
getch();
return 0;
}
When we compile above program, it will produce the following result
Enter the number for value1 :1.5 log10 value 0f 1.500000 is :0.176091
Similar Functions
Other C programming language functions that are similar to the cosine function
suggested for you
User defined function in C language