Okay, so I have to create program that adds the whole numbers from 1 to 1000 and displays the sum in the label. Create a variation of this program that allows the user to specify any starting whole number and any ending whole number (10,000 or lower) and then adds all the whole numbers in that range. Allow for the possibility that a user may start with a high number and end with a low number. Format the label so that commas are displayed and there are no decimal places showing. I need help with the codes.
Public Function AddRange(ByVal LowNum As Long, ByVal HighNum As Long)as Long
dim Result as Long
Result = 0
For i as integer = LowNum to HighNum
Result += i
Next i
AddRange=Result
End Function
Public Function AddRange(ByVal LowNum As Long, ByVal HighNum As Long)as Long
dim Result as Long
Result = 0
For i as integer = LowNum to HighNum
Result += i
Next i
AddRange=Result
End Function
Bookmarks