8
Contributors
9
Replies
12
Views
5 Years
Discussion Span
Last Post by nabanit.sarkar
0

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

Edited by DavidKroukamp: n/a

0

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!

0

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.

1

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 :)

0

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

A
BC
DEF
GHIJ
KLMNO

0

*****
####
***
##
*
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

0

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.

Edited by Ezzaral: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.