【例37.1】 分数加减表达式的值
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
说明
编写程序,输入的值,求$\frac{1}{1}-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}+\frac{1}{5}-\frac{1}{6}+\frac{1}{7}-\frac{1}{8}+...+(-1)^{n-1}\frac{1}{n}$ 的值。
输入格式
输入一个正整数。()。输出格式
输出一个实数,为表达式的值,保留到小数点后四位。样例
2
0.5000
语法组8.14作业——函数与递归
- Status
- Done
- Problem
- 8
- Open Since
- 2023-8-14 12:00
- Deadline
- 2023-8-14 17:00
- Extension
- 0 hour(s)