Monday, June 14, 2010

SUM OF N NUMBERS USING ARRAY

Buzz It


AIM:To find the sum of n numbers using array

CODE

Form 1
Private Sub clear_Click()
Text1.Text = ""
End Sub
Private Sub end_Click()
End
End Sub
Private Sub sum_Click()
Dim i, a, n, sum As Integer
sum = 0
a=1
n = Val(Text1.Text)
Do While a <= n
sum = sum + a
a=a+1
Loop
MsgBox "The Result is" & sum
End Sub



0 comments:

Post a Comment