Is a nested for loop required?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whoami2
    New Member
    • Mar 2007
    • 1

    #1

    Is a nested for loop required?

    I need to list out consecutive numbers up to a certain number, but there can only be 6 values per line. How would I go about doing this. I tried a for loop nested in a while loop, but since I designated for the numbers to list 6 entries and then start a newline, I went over the limit number.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Originally posted by whoami2
    I need to list out consecutive numbers up to a certain number, but there can only be 6 values per line. How would I go about doing this. I tried a for loop nested in a while loop, but since I designated for the numbers to list 6 entries and then start a newline, I went over the limit number.
    I think an if statement might be better, then when it's equal you can print out a newline character, but it depends on your implementation.

    Comment

    Working...