PROCESSING
You will need to store the appropriate characters in each element of the array. The formula for the 'X' is as follows:
Elements at index positions where each index is the same should be given a value of '*'.
For example, [0][0],[1][1], and so on. This covers the rst diagonal line we need to create.
The second diagonal can be created by storing '*' in the positions where both indexes add up to the
size eld's current value minus one.
For example, if the size is 5, the elements would be [0][4], [1][3], [2][2], [3][1], and [4][0].
Every other element should be ' ' (a space). This will ensure the array prints correctly.
Get Free Quote!
326 Experts Online