Blame view

P59539_en/S003-AC.cc 282 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#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;
}