123454321
1234 4321
123 321
12 21
1 1
Solve the pattern with java
Answers
Answered by
0
123454321
1234 4321
123 321
12 21
1 1
0 0
0
1234 4321
123 321
12 21
1 1
0 0
0
Answered by
0
Answer:Answer is in explanation
Explanation:
public class Pattern
{
public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 6 - i; j++)
{
System.out.print(j);
}
for (int j = 3; j <= 2 * i-1; j++) {
System.out.print(" ");
}
for (int j = 6-i; j >= 1; j--)
{
if (i == 1 && j == 5)
{
continue;
}
System.out.print(j);
}
System.out.println();
}
}
}
Similar questions