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

Dim num, n, sum
n= inputbox ("Enter a Value")
sum=0
For num= 1 to n step 1
sum= sum+num
Next
msgbox sum
Display Natural numbers sum up to n? (Using For...Next Loop) Display Natural numbers sum up to n? (Using For...Next Loop) Reviewed by Animesh Chatterjee on January 23, 2010 Rating: 5

No comments:

Powered by Blogger.