RosettaCodeData/Task/Harmonic-series/True-BASIC/harmonic-series.basic

20 lines
337 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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