public class 分数计算 {
public static void main(String[] args) {
double sum 1=0;
double sum 2=0;
double c;
for(double i=1;i<=49;i+=2)
{
sum 1+=(1/i);
}
for(double j=2;j<=50;j+=2)
{
sum 2+=(1/j);
}
c=sum 1-sum 2;
System .out .print l n("和为 "+c);
}
}
和为:0.6832471605759178
07-19
1579
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-16
525
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)