Advertisement
Guest User

Untitled

a guest
May 29th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. public class HelloWorld{
  2.  
  3.      public static void loopLetters(char begin, char end){
  4.          System.out.print(begin);
  5.          System.out.print(" ");
  6.          
  7.          if(begin != end)
  8.             loopLetters(begin += (int) Math.signum(end - begin), end);
  9.          else
  10.             System.out.println();
  11.      }
  12.  
  13.      public static void main(String []args){
  14.         loopLetters('A', 'Z');
  15.         loopLetters('a', 'z');
  16.         loopLetters('Z', 'A');
  17.         loopLetters('z', 'a');
  18.         loopLetters('0', '9');
  19.      }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement