15 lines
194 B
PowerShell
15 lines
194 B
PowerShell
|
|
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.
|