Write program to print the following addition table. Use nested loops. 1 2 3 4 5 6 11 12 13 14 15 16 21 22 23 24 25 26
If these datum are 3 rows of 6 columns, first get them into a data structure(s), and that should inspire how to print them out.
could you use something like this: for (int i = 1; i <= 6 ; i++) { for (int j = 1; i <=3; j++) { println(i); println(i + 10); println(i + 20); } // close j loop } // close i loop Maybe give something like that a try. You'd have to use syntactically correct print statements, including some type of carriage return. And, fair warning, I didn't bother to fire up a compiler to see if this works, so it may be total garbage. I guess you'll have to try it and see for yourself.
Join our real-time social learning platform and learn together with your friends!