123456789101112131415161718 |
- def divide(int)
- return 4.0 / (int * (int + 1) * (int + 2))
- end
- answer = 3
- c = 2
- i = 1
- while c < 100000 do
- if (i % 2 == 0) then
- puts (answer = answer - divide(c))
- c += 2
- else
- puts (answer = answer + divide(c))
- c += 2
- end
- i += 1
- end
|