java - How to write a While Loop for Simple Increments? -


i need write while loop following: "hello" part of output

8 9 11 14 hello 18

    while(counter < 18 )     {         system.out.print(" " + counter);          counter = counter + 1 ;          if(counter > 14 && counter < 18){             system.out.print(" hello ");         }      } 

the above sample code. unable figure out how increase 1, 2 3. can , please?

you need additional variable stores amount increment. variable has incremented 1 in each run of loop.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -