Perfect number

The numbers 4,25,36,49 etc. are called perfect numbers.
This code shows how to find a perfect number and its square root.

Private Sub PerfectNumber()
Dim intNum, intI As Integer

intI = 1
'Consider a number intNum.
intNum = 25
While intI <= intNum
'Increment the number intI by 1.
'If the square of the number
'intI is equal to intNum
'then it is perfect number
'else it is not a
'perfect number.
If intI * intI = intNum Then
MessageBox.Show("The number " & intNum & " is perfect number and its square root is " & intI & ".")
Exit Sub
End If
intI = intI + 1
End While
MessageBox.Show("The number " & intNum & " is not perfect number.")
End Sub


Guest Author: Anonymous06 Jan 2013

25 is not a perfet number lol..

6 and 28 are perfect number but your program says.. its not a perfect number..

i think the title is wrong not the program:D

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: