For the first one you could have just done:


for (i=0; i<20; i++ )
a[i] = i;


For the next one, you'll need to use a nested loop (a loop within a loop).