Functions, real numbers and for loops

Hi, I have this Java problem and I don't completely understand what it means, this is the problem:

Write a function named sumTo() that takes an integer parameter **n** and that returns the sum of the first **n** reciprocals. In other words:

sumTo(n) returns (1 + 1/2 + 1/3 + 1/4 + ... + 1/n)

(of course, 1/2 in this case means .5) For example, **sumTo(2)** should return the value **1.5 (1 + 1/2)**. If **sumTo()** is passed the value **0**, it should return **0.0** as its result. You may assume that **sumTo()** is *never* passed a negative value.

Thanks

Re: Functions, real numbers and for loops

Learn how to use loops.

Also note that

1 + 1/2 + 1/3 + 1/4 + .... = 1/1 + 1/2 + 1/3 + ... = sum(1/i, for i = 1 to n)

Your mission is to write the last expression in for loops which should be pretty easy.