TO PRINT PATTERN TYPE 13
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
class Pattern13
{
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 )
{
System.out.print(k);
if(j<4)
{
k++;
}
else
k--;
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
Comments
Post a Comment