Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Digital-root/ZX-Spectrum-Basic/digital-root.basic
Normal file
18
Task/Digital-root/ZX-Spectrum-Basic/digital-root.basic
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
10 DATA 4,627615,39390,588225,9992
|
||||
20 READ j: LET b=10
|
||||
30 FOR i=1 TO j
|
||||
40 READ n
|
||||
50 PRINT "Digital root of ";n;" is"
|
||||
60 GO SUB 1000
|
||||
70 NEXT i
|
||||
80 STOP
|
||||
1000 REM Digital Root
|
||||
1010 LET c=0
|
||||
1020 IF n>=b THEN LET c=c+1: GO SUB 2000: GO TO 1020
|
||||
1030 PRINT n;" persistance is ";c''
|
||||
1040 RETURN
|
||||
2000 REM Digit sum
|
||||
2010 LET s=0
|
||||
2020 IF n<>0 THEN LET q=INT (n/b): LET s=s+n-q*b: LET n=q: GO TO 2020
|
||||
2030 LET n=s
|
||||
2040 RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue