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

PROGRAMMING:Finding the sum of the first n terms of a simple interleaved sequence

Luz5年前 (2021-05-10)题库395
This problem requires programming to calculate the sum of the first n items of the sequence 1 - 1 / 4 + 1 / 7 - 1 / 10 +.
###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 three decimal places. The calculation results should not exceed the double precision range.
###Input example:
```in
ten
```
###Output example:
```out
sum = 0.819
```






answer:If there is no answer, please comment