RosettaCodeData/Task/Harmonic-series/MSX-Basic/harmonic-series.basic

18 lines
401 B
Plaintext

100 CLS : REM HOME 100 HOME for Applesoft BASIC
110 PRINT "The first twenty harmonic numbers are:"
120 FOR n = 1 TO 20
130 h = h+(1/n)
140 PRINT n,h
150 NEXT n
160 PRINT
170 h = 1
180 n = 2
190 FOR i = 2 TO 10
200 IF NOT(h < i) THEN GOTO 240
210 h = h+(1/n)
220 n = n+1
230 GOTO 200
240 PRINT "The first harmonic number greater than " i "is " h "at position " n-1
250 NEXT i
260 END