Thanks for your help stevf.
It does work now, with the change you mentioned.
I am trying to reverse the pattern though, so that the pattern goes from right to left instead of left to right.
I tried using some formatting such as setw and right justification, but can't seem to get it...