Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Perfect-numbers/VBScript/perfect-numbers.vb
Normal file
17
Task/Perfect-numbers/VBScript/perfect-numbers.vb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Function IsPerfect(n)
|
||||
IsPerfect = False
|
||||
i = n - 1
|
||||
sum = 0
|
||||
Do While i > 0
|
||||
If n Mod i = 0 Then
|
||||
sum = sum + i
|
||||
End If
|
||||
i = i - 1
|
||||
Loop
|
||||
If sum = n Then
|
||||
IsPerfect = True
|
||||
End If
|
||||
End Function
|
||||
|
||||
WScript.StdOut.Write IsPerfect(CInt(WScript.Arguments(0)))
|
||||
WScript.StdOut.WriteLine
|
||||
Loading…
Add table
Add a link
Reference in a new issue