Results 1 to 6 of 6
Thread: Iterative help
- 10-06-2010, 04:21 PM #1
Member
- Join Date
- Oct 2009
- Posts
- 13
- Rep Power
- 0
- 10-06-2010, 04:27 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Write out a description of what it is you would need to do to do this by hand, step by step...then use that to structure your code.
- 10-06-2010, 04:29 PM #3
Member
- Join Date
- Oct 2009
- Posts
- 13
- Rep Power
- 0
i have tried that but i cant seem to understand what i would need to write in order for it to print out 10 20 30 40 50 60 if n=65
- 10-06-2010, 04:43 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
You'll need a loop, probably.
Now think what the exit condition will be for that loop.
- 10-06-2010, 04:43 PM #5
This is a fundamental skill for programmers. You know how to do it by hand, obviously, because you can describe what you need to do. Do it by hand, and stop to think before you write each number: how did I figure that out? How would I tell somebody else, who had no other knowledge, how to do that?
- 10-06-2010, 08:26 PM #6
Senior Member
- Join Date
- Oct 2010
- Posts
- 316
- Rep Power
- 3
Assuming you know how to write an iterative statement, they don't have to just increment by one (e.g. n++, ++n) but can be incremented by any amount (e.g. n+=2, n+=3, n+=4 , increments n by 2, 3, 4 respectively).
I can't give away too much too soon but I hope this helps.
If you're still struggling then post back.
Similar Threads
-
Help needed to turn a recursive method into iterative
By mercyfulfate in forum New To JavaReplies: 5Last Post: 07-16-2010, 06:13 PM -
Turning Recursion Method into Iterative method
By mattakuevan in forum New To JavaReplies: 9Last Post: 06-15-2010, 06:46 AM -
Java class HashIt with a static recursive method and a static iterative method
By kezkez in forum New To JavaReplies: 3Last Post: 02-09-2010, 05:22 AM -
Iterative Algorithms
By Zosden in forum AlgorithmsReplies: 1Last Post: 07-05-2008, 06:29 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks