try it, paste it if you get it, if you don't, post what you got till then...
these patten generating will get you how to use your code repeatedly....there are many levels to this * generation...so doing it will clear your programming concept...
All the best...