I need to print out a pattern that looks like this when N=6

1
21
321
4321
54321
654321

Recommended Answers

I need to print out a pattern that looks like this when N=6

1
21
321
4321
54321
654321

use a for array and iterate through it saving each variable each time, but to the front of the string,this should do the trick with a little editing

Jump to Post

Why is everybody helping a person who can't even ask a normal question?

There can various reason one can think of but I think its
Just because :)

Jump to Post

All 9 Replies

So?

I need to print out a pattern that looks like this when N=6

1
21
321
4321
54321
654321

use a for array and iterate through it saving each variable each time, but to the front of the string,this should do the trick with a little editing

String tmp = "";
        for (int i = 0; i < 4; i++) {
           tmp=i+tmp;
            System.out.println(tmp);

        }

to help you along maybe try changing ' int i=0' that will help you to take away that annoying '0' :),and look at 'i<4'.

hope that helps

Member Avatar

The easiest way is to use 2 for loops (one inside the other).
The outer for loop from 1 to N.
The inner for loop from N to 1.

Assembly required!

Why is everybody helping a person who can't even ask a normal question? If this was a real conversation, you wouldn't ask a question this way either...

I vote for a thread lock, or an edit of the question.

Why is everybody helping a person who can't even ask a normal question?

There can various reason one can think of but I think its
Just because :)

*****
####
***
##
*
Please give me the Coding of following Patterns

A
BC
DEF
GHIJ
KLMNO

*****
####
***
##
*
Please give me the Coding of following Patterns

A
BC
DEF
GHIJ
KLMNO

you should have created a new thread and atleast have done something especially because the answer is only a few posts above with few alterations

Both the OP and the hijacker need to read the forum rules about showing some effort if they want help with homework. This is not a homework completion service.

Thread closed.

can any body solve this pattern
1
1 2
1 2 3
1 2
1

Be a part of the DaniWeb community

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