Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld{
- public static void main(String []args){
- double result=1;
- double sign = -1;
- int n=100000;
- for(int i=2;i<=n;i++)
- {
- result=result+sign/i;
- sign=-sign;
- }
- System.out.println("Calculated value of natural logarithm of 2 is "+ result);
- System.out.println("System function value of natural logarithm value of 2 is: "+Math.log(2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement