- Thread starter
- #1

- Apr 14, 2013

- 4,047

I want to write a program in c, that calculates the sum [1+sum{1/(i(i+1)) from 1 to n}].

I declared the variables as float.

When I run the program with n=9, the output is 1.899999976, but when I calculate this with a calculator the result is 1.9.

Where is the error?