用代码输入一个整数n,计算 1+1/(1-3)+1/(1-3+5)+...+1/(1-3+5-...+2n-1)的值
时间: 2023-09-16 19:12:13 浏览: 110
labview求1+2+3+……(n-1)的值
4星 · 用户满意度95%
```python
n = int(input())
denominator = 1
sum = 0
for i in range(1, n+1):
denominator *= 2*i-1
sum += 1/denominator
result = 1 + sum
print(result)
```
阅读全文