tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 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