-
private sub command1_click()s=0for i = 1 to 1000 step 2s = s + i
next i
print s
end sub
Or. private sub command1_click()i = 1do while i <= 1000s = s + i
i = i + 2
loopprint s
end sub
Or. private sub command1_click()i = 1do until i > 1000s = s + i
i = i + 2
loopprint s
end sub
The answer is 250,000 You can copy it to your vb** window and try it...
-
The factorial of 99 is close to the 156th power of 10, i.e., it is a 155-bit value, which cannot be stored exactly in the VB value type.
Programming problems of the general algorithm type, such as finding the last 6 digits of this value, or using greedy algorithms to calculate factorial sum problems, such problems usually do not exceed the range of 10 factorial values or integer variables.
s=0for i= 1 to 99
for j=1 to i
s1=1s1=s1*j
next j
s=s+s1
next i
-
Summary. The following is a ** for calculating s s s when the value of the i term is less than 10 to the power -4 of the -4 power:
VB programming calculates s=1+1 2+1 4+1 7+1 11+1 16+1 22+1 29+...When the value of item i< -4 power of 10.
The following is the ** of the calculation of s written by the slipper using Visual Basic, which allows the slip ** to calculate the collapse value of s when the value of the i term is less than 10 to the -4th power
In this case, we use a loop to calculate the value of each handicapped item and add it to the variable s until the value of the current item is less than that. In each loop, we first increase the value of i by 1 and then calculate the value of the current term, using the general term Equation 1 ((i-1)*(i+1)) in fractional form. Once the value of the current item is calculated, add it to s until the value of the current item is less than.
Finally, we use the msgbox function to display the value of s in the message box. Note that the computation of this summation series is infinite, so in ** we use a loop to control the end of the computation.
Is there a basic one, such as using from i in range or something like while
Dim i As and mzgbox haven't been learned yet.
Can you take a look at this?
I either want a detailed answer, or I want to take a different approach, because it's school homework and I haven't learned this method you gave me.
You replace msgbox with console
-
I think what you want is the formula above.
-
I didn't see the law of this formula.
Function: Display a character 3
Step 1: Enter the command prompt, type debug, and press enter; >>>More
VB Simple Timing**:
**As follows: DIM S >>>More
The second line declares that the textbox control array ** is wrong and does not conform to the syntax specification! >>>More
Two commandbuttons, two lables, two texts"
private sub command1_click()r = >>>More
Is it to add a cycle, but to know the number of cycles.