|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I am using an InputBox. A person enters a number and a MessageBox should display showing the sum of all the integers from 1 to the value entered. How do I write the code for this.
|
|
#2
|
||||
|
||||
|
Retrieve the number they entered.
Code:
Dim num1 As Integer
num1 = InputBox("Enter a number.")
loop from 1 to the number they entered and add them Code:
Dim i As Integer Dim total As Integer total = 0 For i = 1 To num1 total = total + i Next i Then show the total Code:
MsgBox "The total is: " & total |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|