public class Solution { public static void main(String[] args) { System.out.printf("%s\t%s\n", "i", "m(i)"); for(int i = 1; i <= 20; i++) System.out.printf("%d\t%f\n", i, getMi(1.0 * i)); } public static double getMi(double number) { double sum = 0; for(int i = 1; i <= number; i++) sum += (i * 1.0) / ((i + 1) * 1.0); return sum; } }
相关文章
- 05-28HW5.13