#K56367. Harmonic Series Sum
Harmonic Series Sum
Harmonic Series Sum
You are given an integer (n). Your task is to compute the sum of the first (n) terms of the harmonic series. The harmonic series is defined as:
[ H(n) = \sum_{i=1}^{n} \frac{1}{i} ]
Print the result rounded to 5 decimal places. This problem tests your ability to work with loops and precision in floating-point arithmetic.
inputFormat
The input consists of a single integer (n) ((1 \leq n \leq 10^7)) representing the number of terms in the harmonic series.
outputFormat
Output a single line containing the sum of the harmonic series rounded to 5 decimal places.## sample
5
2.28333
</p>