Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Perfect-numbers/PowerShell/perfect-numbers.psh
Normal file
14
Task/Perfect-numbers/PowerShell/perfect-numbers.psh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Function IsPerfect($n)
|
||||
{
|
||||
$sum=0
|
||||
for($i=1;$i-lt$n;$i++)
|
||||
{
|
||||
if($n%$i -eq 0)
|
||||
{
|
||||
$sum += $i
|
||||
}
|
||||
}
|
||||
return $sum -eq $n
|
||||
}
|
||||
|
||||
Returns "True" if the given number is perfect and "False" if it's not.
|
||||
Loading…
Add table
Add a link
Reference in a new issue