We don't do homework, sorry. We'll help you learn though.
How far have you got with your programs?
Can you see what needs doing in terms of what loop(s) may be needed?

It's useful to break it down into easier tasks; that's how I solve complicated problems. So for example I might start with a program that just displays 5 asterisks in a line (using a loop, not cheating with a single printf). Then I might adjust that to print any number of asterisks in a line.
Then you need to modify it to print multiple lines up to a fixed number.
Then it's just a case of getting that number from the user.

For 2 that's just a simple sort routine.

You'll probably have everything you need in the course notes you've got so far. Relax, don't panic, and let us know where you get stuck.