Advertisement
mcnealk

#18

Oct 2nd, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. /**
  2. * Write a description of class ExerciseEighteen here.
  3. * Kailey McNeal
  4. * 10-2-14
  5. * #18 pg 191
  6. */
  7. public class ExerciseEighteen
  8. {
  9. public static void main(String[]args)
  10. {
  11. vertical("hey now");
  12. }
  13. public static void vertical(String word)
  14. {
  15. int length=word.length(); //length of string
  16. for (int i=0; i<=length; i++)
  17. {
  18. if(i+1>length)
  19. {
  20. System.out.println(word.substring(i));
  21. }
  22. else
  23. {
  24. System.out.println(word.substring(i, i+1));
  25. }
  26.  
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement