Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Locale;
- import java.util.Scanner;
- public class ProjectsCreation {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- char startSymbol = scanner.nextLine().charAt(0);
- char endSymbol = scanner.next().charAt(0);
- printSymbolsInRange(startSymbol, endSymbol);
- }
- static void printSymbolsInRange(char start, char end) {
- if(start < end) {
- for (int ascii = start + 1; ascii <= end - 1; ascii++) {
- System.out.print((char) ascii + " ");
- }
- } else {
- for (int ascii = end + 1; ascii <= start - 1; ascii++) {
- System.out.print((char) ascii + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment