Develop #1

Open
Ramtin wants to merge 5 commits from develop into main
Showing only changes of commit 95028697fd - Show all commits
+13 -5
View File
@@ -2,22 +2,30 @@ public class MainExercises
{
public char[][] generateTriangle(int n) {
char[][] result = new char[n][n];
char[][] result = new char[n][];
for (int i = 0; i < n; i++)
{
if (i == n-1)
char[] line = new char[i+1];
if (i == n-1 || i == 0)
{
for (int j = 0; j <= i; j++)
{
result[i][j] = '*';
line[j] = '*';
}
}
else
{
result[i][0] = '*';
result[i][i] = '*';
line[0] = '*';
line[i] = '*';
for (int j = i - 1; j > 0; j--) {
line[j] = ' ';
}
}
result[i] = line;
}
return result;