-->
当前位置:首页 > 题库

PROGRAMMING:Finding the sum of the first n terms of the n-th interleaved sequence

Luz5年前 (2021-05-10)题库515
Enter a positive integer n to calculate the sum of the first n terms of the sequence 1 - 1 / 2 + 1 / 3 - 1 / 4 +... To three decimal places.
###Input format:
The input gives a positive integer n on one line.
###Output format:
In one line, output the value s of partial sum in the format of "sum = s", accurate to 3 decimal places. The calculation results should not exceed the double precision range.
###Input example:
```in
five
```
###Output example:
```out
sum = 0.783
```







answer:If there is no answer, please comment