please solve
Write a program in java to print the following pattern
Attachments:
Answers
Answered by
1
plz mark it brainliest
and follow me
Attachments:
Answered by
0
int rows=5;
for (int i = 0; i < rows; i++)
{
for (int j = 0; j <= i; j++)
{
if (j % 2 == 0)
{
System.out.print(1 + j * rows - (j - 1) * j / 2 + i - j + " ");
} else
{
System.out.print(1 + j * rows - (j - 1) * j / 2 + rows - 1 - i + " ");
}
}
System.out.println();
Similar questions