I figured it out, thanks everyone (Parranoia, and Norm).
It was a very foolish error. The control statement was (g<0), when it should of been (g>0). I feel dumb. But thanks!
Type: Posts; User: phlegm
I figured it out, thanks everyone (Parranoia, and Norm).
It was a very foolish error. The control statement was (g<0), when it should of been (g>0). I feel dumb. But thanks!
This does help a lot, but do I create these variables in or out of the loop? Or does it not matter?
--- Update ---
Ok, so I think I improved my code. Thanks @Parranoia.
...
I honestly don't know how I would set that up. sorry
Yes I believe it would, but I don't know how to use g twice in the loop. :/
Using the method I'm using, I would have a lot of code, so I realized I couldn't keep doing it the way I am.
What I'm trying to do is to make only one System.out.println that will print every iteration. For example, if I enter in "6" into the command prompt, I would like this to be printed.
36
25
16
9...
What I am trying to accomplish is having the user input a number (5 for example), and then printing 25, 16, 9, 4, and then 1 (squaring each number until it hits 0).
Here is the question: 2457
...