Asked by Dan
How do you do the multiplication table from 0 - 10 with nested loops ?
Answers
Answered by
oobleck
for i=1..10 {print i} /* print the column headers */
for i=1..10 {
print i /* number the rows 1-10 */
for j=1..10 {print i*j}
print "\n" /* go to next row */
}
use a print statement that does not implicitly include a newline
use a formatted print so the digits line up correctly
for i=1..10 {
print i /* number the rows 1-10 */
for j=1..10 {print i*j}
print "\n" /* go to next row */
}
use a print statement that does not implicitly include a newline
use a formatted print so the digits line up correctly
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.