1.1-Introductie-Programmeren

Printing formatted numbers

Difficulty: Filled Filled Outlined

To properly display a large amount of values, it is common to line-wrap them. Line-wrapping is basically hitting the return-key every now and then in order to prevent the text going beyond the visible area.

Create a program that prints a number of values, starting at 1 at running to a user specified maximum. It must wrap the numbers after every 25th number printed.

Note: To help with the layout in the project we suggest the following code: String.format("%3d", counter);. This prints each integer value with additional (leading) whitespaces. This results in the better alignment of the values. See image below.

Example

Example