标签:
1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 double sum = 0; 6 7 for(int i = 1; i <= 50000; i++) 8 sum += 1.0 / (i * 1.0); 9 System.out.println("From left to right, sum is " + sum); 10 11 sum = 0; 12 13 for(int i = 50000; i >= 1; i--) 14 sum += 1.0 / (i * 1.0); 15 System.out.println("From right to left, sum is " + sum); 16 } 17 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5775286.html