2009年2月9日 星期一

麗山50題之4

image

image

image

Public Class Form1
    Dim a, b, d As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        a = Val(TextBox1.Text)
        d = 0
        For b = 1 To Len(a)
            d = d + Val(Mid(a, b, 1))
        Next
        If d Mod 9 = 0 Then
            Label2.Text = "此數可以被9整除"
        Else
            Label2.Text = "此數不能被9整除"
        End If
    End Sub
End Class

沒有留言:

張貼留言