Website Summary Files Commits Branches @commit @diff @stats
path: root / Week04 / Exercise19.cpp
blob: 9238180937212dbea4268d3538f9ec0bbc85ddf6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

int main() {
    unsigned int n;
    std::cin >> n;

    float harmonic_number = 0.0;
    for (unsigned int i = 1; i <= n; i++) {
        harmonic_number += 1.0 / i;
    }

    std::cout << harmonic_number;

    return 0;
}