Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld{
- public static void loopLetters(char begin, char end){
- System.out.print(begin);
- System.out.print(" ");
- if(begin != end)
- loopLetters(begin += (int) Math.signum(end - begin), end);
- else
- System.out.println();
- }
- public static void main(String []args){
- loopLetters('A', 'Z');
- loopLetters('a', 'z');
- loopLetters('Z', 'A');
- loopLetters('z', 'a');
- loopLetters('0', '9');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement