Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Digital-root/DCL/digital-root.dcl
Normal file
18
Task/Digital-root/DCL/digital-root.dcl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
$ x = p1
|
||||
$ count = 0
|
||||
$ sum = x
|
||||
$ loop1:
|
||||
$ length = f$length( x )
|
||||
$ if length .eq. 1 then $ goto done
|
||||
$ i = 0
|
||||
$ sum = 0
|
||||
$ loop2:
|
||||
$ digit = f$extract( i, 1, x )
|
||||
$ sum = sum + digit
|
||||
$ i = i + 1
|
||||
$ if i .lt. length then $ goto loop2
|
||||
$ x = f$string( sum )
|
||||
$ count = count + 1
|
||||
$ goto loop1
|
||||
$ done:
|
||||
$ write sys$output p1, " has additive persistence ", count, " and digital root of ", sum
|
||||
Loading…
Add table
Add a link
Reference in a new issue