Display Natural numbers sum up to n? (Using For...Next Loop)

January 23, 2010

Dim num, n, sum
n= inputbox ("Enter a Value")
sum=0
For num= 1 to n step 1
sum= sum+num
Next
msgbox sum

You Might Also Like

0 comments