In this tutorial, we will discuss log function in the C programming language
In the C programming language, the log() Arithmetic function returns the logarithm of x to the based of e
log(): In C programming Language,log() is used to perform calculate natural logarithm of significant value
The Syntax of the log() in C Programming language
double log(double x);
X is the parameter or argument of this function which is used in the calculation of the logarithm of x to the base of e
The log function returns the logarithm of x to the base of e
In this Language, the required header file for log() is
log function in C
The following example shows the usage of the log()
Program 1
#include <stdio.h> #include <math.h> int main() { double a=1.5,b=1.25; printf("log value of %f is: %f\n",a,log(a)); printf("log value of %f is: %f\n",b,log(b)); getch(); return 0; }
When above program me is compiled it will produce the following result
log value of 1.500000 is: 0.405465
log value of 1.250000 is: 0.223144
program 2
#include <stdio.h> #include <math.h> int main() { //define the variable double logValue; double inputValue; //get input from user printf("Please enter the value to calculate log value :"); scanf("%lf",&inputValue); //calculate the log value logValue=log(inputValue); //display the log value printf("\nlog value of %lf is %lf\n",inputValue,logValue); getch(); return 0; }
When above program me is compiled it will produce the following result
please enter the value to calculate log value :1.5 log value of 1.500000 is 0.405465
Other C programming language functions that are similar to the cosine function
suggested for you
User defined function in C language
How to find reverse number using method In this article, we will discuss the concept…
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…