Exercise : Sequence of numbers
- Write a complete Java program that produces this
sequence of numbers using a
for
loop:
8
11
14
17
20
23
-
Hint: You want to come up with an expression with a multiplier and a
constant. First pick a multiplier (if your loop variable goes up by 1
each time, how much do these numbers go up by each time?). Then pick a
constant (when your loop variable is 1, this is supposed to be 8, what do
you have to add to get this value?).