forloops including a nested loop