view basic/exampl.bas @ 57:2088fd998865

sbc09 directry clean up
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 23 Jul 2018 16:07:12 +0900
parents
children
line wrap: on
line source

10 REM SYRACUSE SEQUENCES.
20 PRINT "ENTER A POSITIVE NUMBER";
30 INPUT K
40 IF K>0 GOTO 70
50 PRINT "ERROR"
60 GOTO 20
70 N=0
80 PRINT K,
90 IF K=1 GOTO 160
100 IF K<>2*(K/2) GOTO 130
110 K=K/2
120 GOTO 140
130 K=3*K+1
140 N=N+1
150 GOTO 80
160 PRINT
170 PRINT "CONVERGED TO 1 IN ";N;" STEPS."
180 END