dimanche 18 octobre 2020

Create a Star pattern utilizing a 2d array and looping in Java

I need to print a 16x16 star pattern with selected elements unfilled so as to make the following pattern using Java. I have tried many different for loops and applied conditions to try and create the pattern to no success. I see that there are many examples of how to make star patterns using for loops but few that utilize a 2d array which is required in this case. I am familiar with the code needed to make the full square but I don't know how to make this pattern. Any help would be greatly appreciated.

*      ********
**      ******
***      ****
****      **
*****     **
******    **
*******   **
******** ****

Aucun commentaire:

Enregistrer un commentaire