Here is a sample program that will ask the user to give a number and then the program will check and determine if the given number is armstrong or not the code is very easy to understand and use. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim n, sum, t, r As String
n = Val(TextBox1.Text)
sum = 0
t = n
While n <> 0
r = n Mod 10
sum += Math.Pow(r, 3)
n = n \ 10
End While
If sum = t Then
Label2.Text = "The number " & t.ToString & " is a Armstrong Number."
Else
Label2.Text = "The number " & t.ToString + " is NOT an Armstrong Number."
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = ""
Label2.Text = ""
TextBox1.Focus()
End Sub
End Class
No comments:
Post a Comment