Dean's right, you're not going to learn much by us telling you....
You learned what tools you have right? Use your imagination and figure out how to use them.
Plus, there's a million in one ways to code for this problem. Take a good guess. Go after it. If it doesn't work you will learn 250% more than you did since you started. IMO you will best learn with trial and error. My favorite exercises in books are the ones with mistakes, makes you think and learn from the mistake.
Hint: use flags (true/false) but that's one of a gazillion methods