Search This Blog

Saturday, 14 April 2018

Write a program to check the number is perfect or not | Perfect number checker in VB 6.0

Write a program to check the number is perfect or not | Perfect number checker in VB 6.0.

Design



Private Sub Command1_Click()
Dim n As Integer, i As Integer, s As Integer
n = Val(Text1.Text)

For i = 1 To n / 2
If n Mod i = 0 Then
s = s + i
End If
Next i
If s = n Then
MsgBox "Perfect"
Else
MsgBox "Not Perfect"
End If
End Sub

Thank You

No comments:

Post a Comment