d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Java Question
Prev12
Add Reply New Topic New Poll
Member
Posts: 13,042
Joined: Apr 12 2008
Gold: 0.00
Sep 17 2014 05:40pm
Quote (carteblanche @ Sep 17 2014 05:56pm)
couple suggestions.

1) stop worrying about the outer loop and just focus on the two inner loops to create 1 line of output.

replace your outer loop with just this:

int i = 7;

2) if you're having a problem with a specific loop, then write the code WITHOUT loops.

ex: instead of something like this:
for (int j = 0; j < 4; j++){
  print(j);
}

you would write this:

print(0);
print(1);
print(2);
print(3);

then once you get the exact output you want, look at the numbers you had to use and figure out the loop that makes it


What do you mean by the outer loop, like the very outer loop(for(int I = 1)?
Member
Posts: 18,375
Joined: May 22 2009
Gold: 58.00
Sep 18 2014 11:06pm
here is psudo code:

A. generate abcdcba
B. generate range of abcdcba
c. apply B to A

c. you only need 2 for loop, you don't need 3.

This post was edited by obviousninja on Sep 18 2014 11:07pm
Go Back To Programming & Development Topic List
Prev12
Add Reply New Topic New Poll