code:
#include <bits/stdc++.h> using namespace std; int main() { int a; double ans; cin >> a; for (int i = 1; i <= a; i++) { ans += pow(-1, i - 1) * (1 / i); } cout << fixed << setprecision(4) << ans; return 0; }