Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main
- {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- //Reading the characters
- int count = 0;
- System.out.print("Enter the start letter: ");
- char startLetter = sc.next().charAt(0);
- System.out.print("Enter the end letter: ");
- char endLetter = sc.next().charAt(0);
- System.out.print("Enter the letter that you don't want to be included: ");
- char notIncludedLetter = sc.next().charAt(0);
- for(char i = startLetter;i<=endLetter;i++){
- if(i != notIncludedLetter){
- for(char l = startLetter;l<=endLetter;l++){
- if(l != notIncludedLetter){
- for(char u = startLetter;u<=endLetter;u++){
- if(u != notIncludedLetter){
- System.out.print(i+ "" + l+"" +u + " ");
- count++;
- }
- }
- }
- }
- }
- }
- System.out.print(" " + count);
- }
- }
Add Comment
Please, Sign In to add comment