1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
Answer :
public class Pattern5 {
public static void main(String[] args) {
for(int i=1;i<7;i++)
{
for(int s=7-i;s>0;s--)
{
System.out.print(" ");
}
for(int k=1;k<=i;k++)
{
System.out.print(k+" ");
}
int d=i-1;
while(0<(d))
{
System.out.print(d+" ");
d--;
}
System.out.println();
}
}
}
No comments:
Post a Comment