Harmonic series: Difference between revisions
m
Added language identifier and moved a comment.
No edit summary |
m (Added language identifier and moved a comment.) |
||
Line 1,063:
=={{Header|Java}}==
<syntaxhighlight lang="java">
import java.math.BigInteger;
▲ * Java does not have a built-in fraction type, so we create our own class Rational.
public class HarmonicSeries {
Line 1,087 ⟶ 1,084:
}
▲ private static Rational harmonicNumber(int aNumber) {
Rational result = Rational.ZERO;
for ( int i = 1; i <= aNumber; i++ ) {
|