I am trying to print a rectangle which allow the user to input width and height. And it should composed of 0 and 1. In the i-th row of the rectangle, the first i-th elements will be 1, other elements will be 0. If the i-th row has less than i elements, fill the whole row with 1. I have no idea how to write this programme by "for" loop. Can someone help me?
Ask yourself:
(1) How many rows will it have (the outer loop)?
(2)(a) How many 1s will it print (minimum of current row and number of columns/width) - first inner loop
(2)(b) How many 0s will it print (number of columns - number of 1s printed) - second inner loop
Make sure that you end the line (at end of outer loop)