Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num, remin, sum, temp As Integer
num = CInt(TextBox1.Text)
temp = num
sum = 0
While num > 0
remin = num Mod 10
sum = sum + (remin * remin * remin)
num = num \ 10
End While
If temp = sum Then
Label2.Text = "Given number is armstrong"
Else
Label2.Text = "Given number is not armstrong"
End If
End Sub
End Class
No comments:
Post a Comment