TO PRINT PATTERN TYPE 15
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
class Pattern15
{
public static void main(String[] args)
{ int k=0,x;
for(int i=1;i<=9;i++)
{ if(i<=5)
k++;
else
k--;
x=1;
for(int j=1;j<=5;j++)
{
if(j>=6-k)
{
System.out.print(x);
x++;
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
Comments
Post a Comment