0

i need desperate help with this one nested loop program:

123454321
1234-4321
123---321
12-----21

(the '-'s are actually supposed to be spaces)

4
Contributors
3
Replies
24
Views
2 Years
Discussion Span
Last Post by TekknoDraykko
2

What do you need help with? What have you done? This is clearly homework, so we need some proof of effort before helping (as per Daniweb rules).

0

As a current student myself, I guess he needs help writing a loop to print what he posted.
I'll get you started by explaining the FOR loop.

That loop cosists of 4 parts:

  1. The initial position of your loop
  2. The condition which signals the end of your loop
  3. What is to be done after each iteration
  4. the iteration/process itself

In code, that would be sketched like so:

for (1; 2; 3;) {
        4;
}

In java:

for (int i = 0; i <= 10; i++){
    System.out.println(i);
}

This example would have this output:

0
1
2
3
4
5
6
7
8
9
10

Edited by Pobunjenik

0

Hello akash_6:
What are the specs (specifications) of the project and what specific question do you have about it? What have you done so far?

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.