I have already seen that someone posted this question a couple of years ago. I do not want any one to flat out give me the answer. I hav the code written, I just cannot figure out why the pattern won't look like this:

1
12
123
1234
12345
123456

123456
12345
1234
123
12
1

Here is my code:

public class TwoPatterns {
  // DECLARE CONSTANTS FIRST
  // Constructor. This replaces the default "no argument" constructor
  public TwoPatterns() {
    super();
  }

  // DESCRIBE EACH METHOD
  private void executeTwoPatternsLogic() {
    //Display pattern 1
    for (int i = 1; i <= 6; i++){
        for (int j = 1; j <= i; j++){
            System.out.print(j);
            } 
        System.out.println("");
    }   
    for (int i = 6; i >= 1; i--){
        for (int j = 6; j >= i; j--){   
            System.out.print(j);
        }
        System.out.println("");
    }
  }
  // main method. Instantiates object; directs it to compute values
  public static void main(String[] args) {
    TwoPatterns tmp = new TwoPatterns();
    tmp.executeTwoPatternsLogic();
    System.exit(0);
  }
}

Anything stand out? Just maybe say look at line..... again??? I am not looking for someone to tell, me I have just been staring at it for a long time and need fresh eyes.

It generates two of the same patterns. And actually indeed that last parter to look like a upside down pyramid. His is driving me crazy!! :)

This article has been dead for over six months. Start a new discussion instead.