Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
log() function in C++
The C/C++ library function double log(double x) returns the natural logarithm (basee logarithm) of x. Following is the declaration for log() function.
double log(double x)
The parameter is a floating point value. And this function returns natural logarithm of x.
Example
#include <iostream>
#include <cmath>
using namespace std;
int main () {
double x, ret;
x = 2.7;
/* finding log(2.7) */
ret = log(x);
cout << "log("<< x <<") = " << ret;
return(0);
}
Output
log(2.7) = 0.993252
Advertisements