Plz Help me to print in java

a
b a b
c b a b c
d c b a b c d
c b a b c
b a b
a

Plz Help me to print in java

a
b a b
c b a b c
d c b a b c d
c b a b c
b a b
a

public class Pattern
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		for(char i='a';i<='d';i++)
		{
			for(char j=i;j>='a';j--)
			{
				System.out.print(j+"\t");
			}
			
			for(char k='b';k<=i;k++)
			{
				System.out.print(k+"\t");
			}
			
			System.out.println();
		}
		
		
		for(char i='c';i>='a';i--)
		{
			for(char j=i;j>='a';j--)
			{
				System.out.print(j+"\t");
			}
			

			
			for(char k='b';k<=i;k++)
			{
				System.out.print(k+"\t");
			}
						
			
			System.out.println();
		}

	}

}

(char) of 97 is 'a'....so us this property.
1. 1st main for loop that prints till
a
b a b
c b a b c
d c b a b c d
to print this u need 2 for loops inside the main for loop
1st first for loop will print reverse order("d c b") the next forloop will print the ordered("a b c d").
2.2nd main for loop will print
c b a b c
b a b
a
this also need 2 for loop inside it......
its working.......

public class Pattern
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		for(char i=97;i<=100;i++)
		{
			for(char j=i;j>96;j--)
			{
				System.out.print(j+"\t");
			}
			
			for(char k=98;k<=i;k++)
			{
				System.out.print(k+"\t");
			}
			
			System.out.println();
		}
		
		
		for(char i=99;i>96;i--)
		{
			for(char j=i;j>96;j--)
			{
				System.out.print(j+"\t");
			}
			

			
			for(char k=98;k<=i;k++)
			{
				System.out.print(k+"\t");
			}
						
			
			System.out.println();
		}

	}

}

Hope it might help you.

Plz Help me to print in java

a
b a b
c b a b c
d c b a b c d
c b a b c
b a b
a

All spacing gets stripped out when you don't use code tags!

[code]

// paste pattern here

[/code]

a
                                            b a b
                                         c b a b c
                                      d c b a b c d
                                         c b a b c
                                           b a b
                                              a

It still looks off. You'll need to repost. Hit "Preview Post" and edit till it looks correct on the post, then hit "Submit Reply".

a
      b a b
    c b a b c
  d c b a b c d
    c b a b c
      b a b
        a
a
      b a b
    c b a b c
  d c b a b c d
    c b a b c
      b a b
        a

OK, there have been a bunch of posts previously on this thread. You haven't commented on them. Did they solve it for you? Do you have any code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.