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.
Is a nested for loop required?
Collapse
X
-
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.Originally posted by whoami2I 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.
Comment