Display Natural numbers sum up to n? (Using Do...Until...Loop)

January 23, 2010

Dim num, n, sum
n= inputbox ("Enter a Value")
sum=0
num=1
Do
sum= sum+num
num=num+1
Loop Until num =cdbl (n+1)
msgbox sum

You Might Also Like

0 comments