In the formatting examples from the chapter, we always provided a fixed control string, such as
System.out.format("%4d", 23);
It is possible, however, to dynamically create the control string, as in
int i = 4;
System.out.format("%" + i + "d", 23);
Using this idea of dynamically creating a control string, write a code fragment that outputs 50 X’s, using a separate line for each X. An X on a single line is preceded by two more leading spaces than the X on the previous line. The following figure shows the output for the first five lines.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.