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

19 lines
337 B
Text

LET h = 0
PRINT "The first twenty harmonic numbers are:"
FOR n = 1 TO 20
LET h = h + 1 / n
PRINT n, h
NEXT n
PRINT
LET h = 1
LET n = 2
FOR i = 2 TO 10
DO WHILE h < i
LET h = h + 1 / n
LET n = n + 1
LOOP
PRINT "The first harmonic number greater than "; i; " is "; h; ", at position "; n - 1
NEXT i
END