A triple for-loop from our exam...
First of all, please move this thread if it is in totally wrong place.
Anyway, I took today in our university an exam in Discrete Mathematics. The question itself was easy and I know the answer too (by counting it with computer), but what is the formula to solve this? Here's the code as VBA code:
Code:
Sub forlooptask()
Dim i As Long, j As Long, k As Long, x As Long
For i = 1 To 200
For j = 1 To i - 1
For k = 1 To j
x = x + 1
Next k
Next j
Next i
Debug.Print x
End Sub
the result is 1333300. The question is: How does the equation for solving this go? Where does that 200 go to?