Can anyone help me with this nested loops homework problem? I'm stuck on it and I'll be beyond grateful for anyone's help.
2. Request an integer value n.
Output a n x n grid from 1 to n inclusive where the following is true:
For each factor f of n:
If the current row number is equivalent to f, output f X’s.
Otherwise output blank spaces or lines (for non-factor rows).
Example Output (input in bold italics)
Enter an integer: 6
X
X X
X X X
(blank)
(blank)
X X X X X X
-> Request an integer value n.
-> Loop through 1 to n (let the counter variable be named 'i').
-> If the counter variable 'i' divides n evenly, print 'i' number of Xs.
-> Print a new line after every iteration.
So you're gonna require a for-loop to iterate 1 through n and another for-loop inside this for-loop to print Xs.