#include <iostream> #include <bits/stdc++.h> using namespace std; int main() { int n = 0; double sum = 0; cin>>n; for (int i = 1; i <= n; i++) { sum += 1.0 / i; } cout << fixed << setprecision(6) << sum; system("pause"); return 0; }
#include <iostream> #include <bits/stdc++.h> using namespace std; int main() { int n = 0; double sum = 0; cin>>n; for (int i = 1; i <= n; i++) { sum += 1.0 / i; } cout << fixed << setprecision(6) << sum; system("pause"); return 0; }