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

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

Luz5年前 (2021-05-10)题库344
This problem requires the preparation of procedures, calculation sequence 1 - 1 / 3 + 1 / 5 - 1 / 7 +... Of the first $$n $$.
###Input format:
Input gives a positive integer $$n $$on a line.
###Output format:
In one line, output the value of partial sum $$s $$in the format of "sum = s", accurate to six decimal places. Please note that there is a space on the left and right of the equal sign. The calculation results should not exceed the double precision range.
###Input example:
```in
five
```
###Output example:
```out
sum = 0.834921
```







answer:If there is no answer, please comment