I am not able to code this is java.
I have to use nested loops.
The pattern I need to get is
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Recommended Answers

All 3 Replies

What have you tried so far, or, at least, what are your ideas as to how it could work?

I am not able to code this is java.
I have to use nested loops.
The pattern I need to get is
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

You should have tried for this.

int end = 5;
    for(int i=end; i>= 1;i--){
      System.out.println();
      for(int j=1;j<=i;j++){
        System.out.print(j);
      }
    }

it's not urgent, and it's not "a doubt". In fact that's a completely incorrect way to use the word "doubt".

Do your own homework, we're not here to help you cheat your way to a diploma so you can then steal our jobs.

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.