代码实例图:
package judgment;
/**
* 计算下面级数之和
* 1/3+3/5+5/7+...+97/99;
*/
public class Judgment {
public static void main(String[] args) {
double num=0;
for (int i = 1; i <=97; i+=2) {
num+=i/(i+2.0);
}
System.out.println(num);
}
}
结果示例图
2022-10-27 10:31:31
代码实例图:
package judgment;
/**
* 计算下面级数之和
* 1/3+3/5+5/7+...+97/99;
*/
public class Judgment {
public static void main(String[] args) {
double num=0;
for (int i = 1; i <=97; i+=2) {
num+=i/(i+2.0);
}
System.out.println(num);
}
}
结果示例图
下一篇:咳咳咳,大家七夕都过得怎么样啊?