TO PRINT PATTERN TYPE 27
1
212
32123
4321234
class Pattern27
{
public static void main(String[] args)
{
for(int i=1;i<=4;i++)
{ int k=i;
for(int j=1;j<=7;j++)
{
if(j>=5-i&&j<=3+i)
{ if(j<4)
System.out.print(k--);
else
System.out.print(k++);
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
212
32123
4321234
class Pattern27
{
public static void main(String[] args)
{
for(int i=1;i<=4;i++)
{ int k=i;
for(int j=1;j<=7;j++)
{
if(j>=5-i&&j<=3+i)
{ if(j<4)
System.out.print(k--);
else
System.out.print(k++);
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
Comments
Post a Comment