0

Can I print this with triangle shape in Java?

I tried to print this with only border "1"s:

int[][] matrix = new int[5][5];


for (int i = 0; i < 5; i++) {

    matrix[i][i] = 1;
    matrix[i][0] = 1;

}
azro
  • 53,056
  • 7
  • 34
  • 70
  • You're missing code, please share all you have, the current output and the expected output [edit] your post for that – azro Dec 31 '22 at 11:25
  • 1
    "*Can I print this with triangle shape in Java?*" - Yes. --- On a sidenote: It's called Pas**c**al's triangle, named after [Blaise Pascal (`en.wikipedia.org`)](https://en.wikipedia.org/wiki/Blaise_Pascal). – Turing85 Dec 31 '22 at 11:25

0 Answers0