Oh, well in that case, how are you storing the matrix? Probably an array of numbers, I would guess.
If you are just starting, might be easiest to use a 2D array; declare an mxn array of integers (or whatever data type you need to hold, where m = number of rows, n = number of columns). If you are dealing strictly with square matrices, then m = n.
For the upper triangular one:
Simply loop through and print out the first n entries of row 1, (n-1) entries of row 2, (n-2) entries of row 3, ... , (n - (m-1)) = (n - m + 1) entries of row m.
If you are a little heavier on the math side, you could also try to implement it using a 1D array, (after all, a rectangular 2D array is really just a 1D array in disguise).
Ummm, the lower triangular one is very similar, if you can see the pattern then you should be on track to solving it now..