double result = 0;double temp = 0;for (int i=0; i<10000; i++) {temp = (i%2==0?1:-1) / (i*2+1);result += temp;}System.out.println("结果为" + result);