CodePudding user response:
This I took only a stupid way,Sub demo ()
Dim arr, I As Long As Long j, k, As Long As l Long
Arr=Array (1, 2, 3, 4, 5, 6, 7, 8, 9)
For I=LBound (arr) To UBound (arr) - 1 'traverse two addition
For j=I + 1 To UBound (arr)
The Debug. Print arr (I) & amp; "+" & amp; Arr (j)
Next j
Next I
For I=LBound (arr) To UBound (arr) - 2 'traversal three addition
For j=I + 1 To UBound (arr) - 1
For k=j + 1 To UBound (arr)
The Debug. Print arr (I) & amp; "+" & amp; Arr (j) & amp; "+" & amp; Arr (k)
Next k
Next j
Next I
For I=LBound (arr) To UBound (arr) - 3 'traversal four addition
For j=I + 1 To UBound (arr) - 2
For k=j + 1 To UBound (arr) - 1
For l=k + 1 To UBound (arr)
The Debug. Print arr (I) & amp; "+" & amp; Arr (j) & amp; "+" & amp; Arr (k) & amp; "+" & amp; Arr (l)
Next l
Next k
Next j
Next I
End Sub
CodePudding user response:
Double loop can.For I=1 to 99 do
K=I + 1
IBase=0
For j=1 to I
IBase=iBase + a (j)
Next
For j=k to 100
Print the iBase + a (j)
Next
Next