Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Reverse the Pattern of this output

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Reverse the Pattern of this output

    Hello everyone, I am a first year student and i have a home work. i solved the first problem but the second one i cannot, this is the
    code and output..
    public class exe2
     {
     public static void main(String[] args) {
     int  x,y;
     
     for(x=10; x>0; x--)
     {
     for (y=0; y<x; y++)
     {
     System.out.print("*_");
     }
     System.out.println();
     }
    }
    }

    OUTPUT
    *_*_*_*_*_*_*_*_*_*_
    *_*_*_*_*_*_*_*_*_
    *_*_*_*_*_*_*_*_
    *_*_*_*_*_*_*_
    *_*_*_*_*_*_
    *_*_*_*_*_
    *_*_*_*_
    *_*_*_
    *_*_
    *_

    please help me to debug the code and reverse the output like this..

    *_
    *_*_
    *_*_*_
    *_*_*_*_
    *_*_*_*_*
    *_*_*_*_*_*_


    thank you...


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Reverse the Pattern of this output

    What is there to debug? Pay attention to what the loops are doing. Work through this by hand, with a piece of paper and a pencil, to get a better idea of what's going on.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Reverse the Pattern of this output

    very nice answer...

Similar Threads

  1. Reverse String
    By WantHelp in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 5th, 2011, 06:14 AM
  2. Regular Expression pattern - complex pattern syntax
    By SmartAndy in forum Algorithms & Recursion
    Replies: 3
    Last Post: June 7th, 2011, 04:40 AM
  3. How to reverse a string, skiping numbers , and ' ?
    By mlotfi in forum Algorithms & Recursion
    Replies: 2
    Last Post: May 26th, 2011, 05:13 AM
  4. Reverse Number guessing game
    By rarman555 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 23rd, 2011, 10:39 PM
  5. Reverse Number
    By java1 in forum Java Theory & Questions
    Replies: 2
    Last Post: October 28th, 2009, 10:19 AM