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);
- System.out.print("Enter n: ");
- int n = Integer.parseInt(sc.nextLine());
- System.out.print("Enter l: ");
- int l = Integer.parseInt(sc.nextLine());
- for(int d1 = 1;d1<=n;d1++){
- for(int d2 = 1;d2 <= n;d2++){
- for(char l1 = 'a';l1 < 'a' + l;l1++){
- for(char l2 = 'a';l2 < 'a' + l;l2++){
- for(int d3 = Math.max(d1,d2)+1;d3<=n;d3++){
- System.out.print(String.format("%d%d%c%c%d",d1,d2,l1,l2,d3));
- System.out.println();
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment