Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
function Get-DigitalSum ([string] $number, $base = 10)
|
||||
{
|
||||
if ($number.ToCharArray().Length -le 1) { [Convert]::ToInt32($number, $base) }
|
||||
else
|
||||
{
|
||||
$result = 0
|
||||
foreach ($character in $number.ToCharArray())
|
||||
{
|
||||
$digit = [Convert]::ToInt32(([string]$character), $base)
|
||||
$result += $digit
|
||||
}
|
||||
return $result
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue