Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Digital-root/Nascom-BASIC/digital-root.basic
Normal file
21
Task/Digital-root/Nascom-BASIC/digital-root.basic
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
10 REM Digital root
|
||||
20 FOR I=0 TO 6
|
||||
30 READ A
|
||||
40 N=A:B=10:GOSUB 500
|
||||
50 PRINT SPC(7-LEN(STR$(A)));A;PERS;ROOT
|
||||
60 NEXT I
|
||||
70 DATA 1,14,267,8128,39390,588225,627615
|
||||
80 END
|
||||
490 REM ** Calculate digital root
|
||||
495 REM and persistance
|
||||
500 PERS=0
|
||||
510 IF N<B THEN 590
|
||||
520 S=0
|
||||
530 S=S+N-INT(N/B)*B
|
||||
540 N=INT(N/B)
|
||||
550 IF N>0 THEN 530
|
||||
560 PERS=PERS+1
|
||||
570 N=S
|
||||
580 GOTO 510
|
||||
590 ROOT=N
|
||||
600 RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue