Friday, 14 June 2013

Armstrong Number

Armstrong Number Code :-

Design Form like that :- 


And write down that code :-

Private Sub Command1_Click()
Dim i, x, r, n As Integer
n = InputBox("enter the numnber")
x = n
i = 0
While (x > 0)
r = x Mod 10
i = i + r * r * r
x = Int(x / 10)
Wend
If n = i Then
Print "Armstrong"
Else
    Print "not armstrong"
    End If
End Sub

7 comments:

  1. thanks for this information....and thanks for adding the design screen

    ReplyDelete
  2. Nice codding.....help me to get understand easily.

    ReplyDelete
  3. This is not a proper code for armsArmst number. First we have to count the lenth of the number then power this count variable to each of the digit of the given number.

    ReplyDelete