1 public class P85Excise { 2 3 public static void main(String[] args) { 4 // TODO 自动生成的方法存根 5 6 int i =1; 7 float sum = 0; 8 float fm = 1; 9 10 while(i<=20) 11 12 { 13 fm*=i; 14 sum+=1/fm; 15 i++; 16 } 17 18 System.out.println("结果是:"+sum); 19 20 } 21 22 }
结果是:1.7182816