write a blue j program to create pattern
1
121
12321
1234321
12321
121
1
Answers
Answered by
5
class pattern
{
public void show()
{
int i,j;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++) System.out.print(j);
for(j=i-1;j>=1;j--) System.out.print(j);
System.out.println();
}
for(i=3;i>=1;i--)
{
for(j=1;j<=i;j++)System.out.print(j);
for(j=i-1;j>=1;j--)System.out.print(j);
system.out.println();
}
}
}
{
public void show()
{
int i,j;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++) System.out.print(j);
for(j=i-1;j>=1;j--) System.out.print(j);
System.out.println();
}
for(i=3;i>=1;i--)
{
for(j=1;j<=i;j++)System.out.print(j);
for(j=i-1;j>=1;j--)System.out.print(j);
system.out.println();
}
}
}
Similar questions