Urgently ask for the value of the VB program segment s 1 3 5 7 999

Updated on technology 2024-05-27
5 answers
  1. Anonymous users2024-02-11

    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...

  2. Anonymous users2024-02-10

    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

  3. Anonymous users2024-02-09

    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

  4. Anonymous users2024-02-08

    I think what you want is the formula above.

  5. Anonymous users2024-02-07

    I didn't see the law of this formula.

Related questions
8 answers2024-05-27

Function: Display a character 3

Step 1: Enter the command prompt, type debug, and press enter; >>>More

6 answers2024-05-27

The second line declares that the textbox control array ** is wrong and does not conform to the syntax specification! >>>More

3 answers2024-05-27

Two commandbuttons, two lables, two texts"

private sub command1_click()r = >>>More

5 answers2024-05-27

Is it to add a cycle, but to know the number of cycles.