Harmonic series: Difference between revisions

Added Easylang
(Add C# implementation)
(Added Easylang)
Line 795:
</pre>
 
 
=={{header|EasyLang}}==
{{trans|BASIC256}}
<syntaxhighlight>
numfmt 5 2
print "The first twenty harmonic numbers are:"
for n = 1 to 20
h += 1 / n
print n & " " & h
.
print ""
print "The first harmonic number greater than: "
h = 1
n = 2
for i = 2 to 10
while h < i
h += 1 / n
n += 1
.
print i & " is " & h & ", at position " & n - 1
.
</syntaxhighlight>
{{out}}
<pre>
The first twenty harmonic numbers are:
1 1
2 1.50000
3 1.83333
4 2.08333
5 2.28333
6 2.45000
7 2.59286
8 2.71786
9 2.82897
10 2.92897
11 3.01988
12 3.10321
13 3.18013
14 3.25156
15 3.31823
16 3.38073
17 3.43955
18 3.49511
19 3.54774
20 3.59774
 
The first harmonic number greater than:
2 is 2.08333, at position 4
3 is 3.01988, at position 11
4 is 4.02725, at position 31
5 is 5.00207, at position 83
6 is 6.00437, at position 227
7 is 7.00127, at position 616
8 is 8.00049, at position 1674
9 is 9.00021, at position 4550
10 is 10.00004, at position 12367
</pre>
 
=={{header|Factor}}==
1,983

edits