annotate basic/exampl.bas @ 191:d0f5894e9b3a
default tip
some how load: confilicts in gmake
author |
kono |
date |
Thu, 07 Dec 2023 09:37:15 +0900 |
parents |
2088fd998865 |
children |
|
rev |
line source |
57
|
1 10 REM SYRACUSE SEQUENCES.
|
|
2 20 PRINT "ENTER A POSITIVE NUMBER";
|
|
3 30 INPUT K
|
|
4 40 IF K>0 GOTO 70
|
|
5 50 PRINT "ERROR"
|
|
6 60 GOTO 20
|
|
7 70 N=0
|
|
8 80 PRINT K,
|
|
9 90 IF K=1 GOTO 160
|
|
10 100 IF K<>2*(K/2) GOTO 130
|
|
11 110 K=K/2
|
|
12 120 GOTO 140
|
|
13 130 K=3*K+1
|
|
14 140 N=N+1
|
|
15 150 GOTO 80
|
|
16 160 PRINT
|
|
17 170 PRINT "CONVERGED TO 1 IN ";N;" STEPS."
|
|
18 180 END
|