标签:
1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 System.out.printf("%s\t%s\n", "i", "m(i)"); 6 7 for(int i = 1; i <= 20; i++) 8 System.out.printf("%d\t%f\n", i, getMi(1.0 * i)); 9 } 10 11 public static double getMi(double number) 12 { 13 double sum = 0; 14 for(int i = 1; i <= number; i++) 15 sum += (i * 1.0) / ((i + 1) * 1.0); 16 return sum; 17 } 18 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5791177.html