Write a program in java to print the following pattern: 123454321
1234 4321
123 321
12 21
1 1
12 21
123 321
1234 4321
123454321
Answers
Answered by
3
Answer:
class abc
{
public static void main(String args[ ])
{
int i, j, k, p,d;
int p=5;d=1;
System.out.println("The pattern of Triangle");
for (i=1;i<=5;i++)
{
for(j=1;j<=p;j++)
System.out.print(j);
for(k=1;k<=1;k++)
System.out.print(" ");
for(k=p;k>=1;k--)
System.out.print(k);
System.out.println();
p=p-1;d=d+2;
}
}
Similar questions