Pyramid Pattern
Dear Listers,
I am in the process of wrting a java code that prints the following pattern
123454321
1234*4321
123***321
12*****21
1*******1
This is the code that I have written as
public class Pyramid
{
public static void main(String[] args)
{
int j;
for (int i=1; i<5; i++)
{
for(j=1; j<5; j++)
{
System.out.print(j);
}
for(int k=j; k>0; k--)
{
System.out.print(k);
}
System.out.println();
}
}
}
My out put is
123454321
123454321
123454321
123454321
Reuqest some hint in acheiving the desired output.
Thanks
Vilas