Advertisement
Spocoman

02. Letters Combinations

Aug 30th, 2024
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class LettersCombinations {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         char x = scanner.nextLine().charAt(0),
  7.                 y = scanner.nextLine().charAt(0),
  8.                 z = scanner.nextLine().charAt(0);
  9.         int counter = 0;
  10.  
  11.         for (int i = x; i <= y; i++) {
  12.             for (int k = x; k <= y; k++) {
  13.                 for (int j = x; j <= y; j++) {
  14.                     if (i != z && k != z && j != z) {
  15.                         System.out.printf("%c%c%c ", i, k, j);
  16.                         counter++;
  17.                     }
  18.                 }
  19.             }
  20.         }
  21.         System.out.println(counter);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement