30 August, 2007

10/10 again

this was a prac test (Computers)
man that was such an easy code....
i got 10/10
for those who want it >>>

'program where user enters an odd number for starting point and any number on ending point and the program prints all odd numbers between starting and ending number and their (the printed number's) sum.

Private Sub Command1_click()
a=val(text1.text)
k=val(text2.text)
j=0

for m=a to k step 2
print m
j=m
b=b+j
next m

msgbox("The sum of the odd numbers is: " & b)

End Sub

No comments: