RosettaCodeData/Task/Harmonic-series/Run-BASIC/harmonic-series.basic
2023-07-01 13:44:08 -04:00

16 lines
338 B
Text

print "The first twenty harmonic numbers are:"
for n = 1 to 20
h = h + 1 / n
print n; chr$(9);h ' print n,h for Just BASIC and Liberty BASIC
next n
print
h = 1
n = 2
for i = 2 to 10
while h < i
h = h + 1 / n
n = n +1
wend
print "The first harmonic number greater than ";i; " is ";h;" at position ";n-1
next i
end