Advertisement
finderabc

PasswordGenerator

Jul 6th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. package TestApril14_15;
  2.  
  3. import java.util.Scanner;
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class Passwordgenerator {
  8.     public static void main(String[] args) {
  9.         Scanner scanner = new Scanner(System.in);
  10.  
  11.         int first = Integer.parseInt(scanner.nextLine());
  12.         char second = scanner.nextLine().toUpperCase().charAt(0);
  13.         char third = scanner.nextLine().toLowerCase().charAt(0);
  14.         int fourth = Integer.parseInt(scanner.nextLine());
  15.         int fifth = Integer.parseInt(scanner.nextLine());
  16.         int sixth = Integer.parseInt(scanner.nextLine());
  17.  
  18.         int num = Integer.parseInt(scanner.nextLine());
  19.  
  20.         int counter = 0;
  21.         for (int i = 1; i <= first; i++) {
  22.             for (char j = 'A'; j <= second; j++) {
  23.                 for (char k = 'a'; k <= third; k++) {
  24.                     for (int l = 1; l <= fourth; l++) {
  25.                         for (int m = 1; m <= fifth; m++) {
  26.                             for (int o = 1; o <= sixth; o++) {
  27.                                 counter++;
  28.                                 if(counter == num) {
  29.                                     System.out.printf("%s%s%s%s%s%s",i,j,k,l,m,o);
  30.  
  31.                                 }
  32.                             }
  33.                         }
  34.                     }
  35.                 }
  36.             }
  37.         }
  38.  
  39.         if (counter < num) {
  40.             System.out.println("No password on this position");
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement