How to Calculate Natural Logarithm Value of a Number in Java


In this example we will show how to find natural logarithm value of a number with log method of java Math class.

Source Code

package com.beginner.examples;

public class LogExample {

    public static void main(String[] args){
    	//return natural logarithm value of a number.
    	System.out.println("Natural logarithm value of 5 is : " + Math.log(5));      
    }
}

Output:

Natural logarithm value of 5 is : 1.6094379124341003
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments