Last post Nov 04, 2011 04:23 PM by bionictiki
Nov 04, 2011 02:25 PM|bionictiki|LINK
Does anyone know how to create this sequence using a for loop and/or nested for loops? I'm having trouble. Thanks
Nov 04, 2011 02:47 PM|atconway|LINK
Yep here it is:
Dim MyIntList As New List(Of Integer)
Dim x As Integer = 1
For j As Integer = 1 To 11
For i As Integer = x To 11
If (x > 1) And (i = 11) Then i = 0
If (x > 1) And (i = (x - 1)) Then Exit For
x += 1
An interview or logic question by chance. I didn't recognize a number pattern I am familiar with (which is almost none) so if that is a know pattern
they may be a mathematically better way to solve this problem. There is probably other ways to refine the code, but what I provided you will spit out those 121 numbers in the exact order you provided.
Hope this helps!
Nov 04, 2011 04:23 PM|bionictiki|LINK
Thanks atconway! It's for a employee rotation. each number represents a job postion in the rotation.