Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • You know how to do it with a for loop but can't figure out how to do it with a while loop? That seems odd to me since for loops and while loops are usually taught at the same time. Are you just having trouble with the syntax? If that's the case, then the answer will depend on the language. Unfortunately you forgot to mention in your question which language you're using. Commented Jan 23, 2011 at 1:51
  • 1
    Add the code for your best shot, and you will likely get help. Commented Jan 23, 2011 at 1:53
  • 1
    Consider posting your for loop solution. People are more likely to help with homework if it's clear you've made an attempt. Commented Jan 23, 2011 at 1:53