26th Jul 2022, 4:03 PM
Akash Prakash
Akash Prakash - avatar
1 Answer
+ 1
It's supposed to create a n by n box. The box is represented by a matrix. "i" is the row number. "j" the column number. First row is line (all stars). Thus the "i == 1" condition. No matter which column, there will be a star. The same goes for the last row which is the "i == n" condition. For any other row, only the beginning and end have stars. Expressed by conditions "j == 1" and "j == n". The if statement will print star if any of the conditions are true. Expressed by the logical or statements "||".
26th Jul 2022, 4:29 PM
Mustafa A
Mustafa A - avatar