S003-AC.cc
282 Bytes
#include <iostream>
using namespace std;
int main()
{
cout << fixed;
cout.precision(4);
double result = 0;
int n;
cin >> n;
if(n != 0)
{
for(int i = 1; i < n+1; i++)
{
result += 1.0/i;
}
cout << result << endl;
}
else
{
cout << 0.0 << endl;
}
return 0;
}