Im writing a program that takes a number inputed and prints the first n positive numbers beginning at 0 by 10's, separated by spaces.
For example: n=4 prints 0, n=65 prints 0 10 20 30 40 50 60
Im not understanding how to write this using an iterative method. Any help please?
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.
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
You'll need a loop, probably.
Now think what the exit condition will be for that loop.
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?
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.