VB Homework Question Help 10, VB Homework Question Help

Updated on educate 2024-05-21
3 answers
  1. Anonymous users2024-02-11

    It seems that the upstairs program is also a bit wrong.

    randomize

    dim a(3), max, i, j, tfor i = 1 to 3

    a(i) = int(rnd * 200) +1next i

    max = a(1)

    for i = 1 to 3

    for j = i + 1 to 3

    if a(j) >= a(i) then

    max = a(j)

    elset = a(i)

    a(i) = a(j)

    a(j) = t

    end if

    next j, i

    print a(1), a(2), a(3)

  2. Anonymous users2024-02-10

    i loops three times with values of 1, 2, 3

    j cycles 1+2+3=6 times in i three cycles, and their values are 1; 1,2;1,2,3

    k has a total of 3+3+2+3+2+2+1=14 cycles in 6 cycles of j.

    Its internal n=n+1 is executed 14 times, so the value of n in the end is 14

  3. Anonymous users2024-02-09

    n is initially 0

    Entering the first loop, i is calculated from 1-3.

    In the second loop, the value of j is calculated from 1 to the value of i at that time.

    In the third loop, the value of k is equal to the value of j at that time and the value is 3.

    Finally, the calculation of n plus 1 is performed.

    The final value of n is 3+3+2+3+2+1=14

    i=1, j loops from 1-1, k=j=1, then k loops from 1 to 3, n is operated 3 times in this loop, and the value after coming out is n=3

    i=2, j loops from 1-2, k=j=1, then k loops from 1 to 3, n is operated 3 times in this loop, and the value after coming out is n=6

    i=2, j loops from 1-2, k=j=2, then k loops from 2 to 3, n is operated 2 times in this loop, and the value after coming out is n=8

    i=3, j loops from 1-3, k=j=1, then k loops from 1 to 3, n is operated 3 times in this loop, and the value after coming out is n=11

    i=3, j cycles from 1-3, k=j=2, then k cycles from 2 to 3, n is operated 2 times in this cycle, and the value after coming out is n=13

    i=3, j cycles from 1-3, k=j=3, then k cycles from 3 to 3, n is operated 1 time in this cycle, and the value after coming out is n=14

Related questions
14 answers2024-05-21

A good example in my heart.

The ancients said: "See the virtuous and think about it".It is often said that "the power of example is endless".As a result, people admired celebrities, worshipped heroes, and pursued stars. Of course, I also have a good example to learn from in my heart. >>>More

5 answers2024-05-21

There are a lot of specific methods that others have said above, so I won't say a lot, but briefly talk about what you may need to pay attention to: >>>More

9 answers2024-05-21

b is printed incorrectly, it should be hard

hard, when spoken as an adjective, can be translated as difficult, hard. >>>More

12 answers2024-05-21

sits on lucy's right.(synonyms).

lucy sits on lily's left. >>>More

6 answers2024-05-21

i=1,j=1:x(1,1)=x(0,0)+1+1=2i=1,j=2:x(1,2)=x(0,1)+1+2=3...

i=1,j=5:(x,5)=x(0,4)+1+6=6--- >>>More