Knute Snortum wrote:A for loop has a lot of flexibility. You can increment/decrement your variable by any amount:
You can initialize and increment more than one variable:
Tommy Johnson wrote:if I need to use double values instead of int that shouldn't make a difference right?
Knute Snortum wrote:Now, the two things I can see that are a problem with the for loop are that you can't have a comma in the "while" part of the for loop (the middle). Pick one variable. Second, literal doubles need a decimal point, so write 1.0, not 1. See how that works for you.
I have corrected the code tags, and also removed some unnecessary tab characters to improve the indentation.
Knute Snortum wrote: . . .
* You're still not using code tags correctly. The code goes between the starting tag and the end tag.
. . .
That assumes OP wants a tab character rather than those spaces.
RahulRise Das wrote:And use \t instead of . . .
RahulRise Das wrote:It's ok, Tommy to test yourself but i suggest you use arrays for this program which is much more accurate than assigning instance variable range
RahulRise Das wrote:Tommy's code needed refinement and the code has to be written properly.
And your code proves it compared to his and mine.