Puzzle L10

Print the integers from 0 to 24, five per line

[E-5]Write a main() program that prints the integers from 0 to 24 (inclusive). Print five integers per line. The output of the program is:

  0  1  2  3  4
  5  6  7  8  9
 10 11 12 13 14 
 15 16 17 18 19
 20 21 22 23 24

Often in programming you want to format the output in a style similar to this. If you have not seen this before, it may take some thought to figure out how to do it. (Hint: Look at the last integer of each line and use the modulo operator %).

Use puzzle L03 as the basis for this one .



Previous Page        Answer         Next Page         Home