Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TestApril14_15;
- import java.util.Scanner;
- import java.util.Scanner;
- public class Passwordgenerator {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int first = Integer.parseInt(scanner.nextLine());
- char second = scanner.nextLine().toUpperCase().charAt(0);
- char third = scanner.nextLine().toLowerCase().charAt(0);
- int fourth = Integer.parseInt(scanner.nextLine());
- int fifth = Integer.parseInt(scanner.nextLine());
- int sixth = Integer.parseInt(scanner.nextLine());
- int num = Integer.parseInt(scanner.nextLine());
- int counter = 0;
- for (int i = 1; i <= first; i++) {
- for (char j = 'A'; j <= second; j++) {
- for (char k = 'a'; k <= third; k++) {
- for (int l = 1; l <= fourth; l++) {
- for (int m = 1; m <= fifth; m++) {
- for (int o = 1; o <= sixth; o++) {
- counter++;
- if(counter == num) {
- System.out.printf("%s%s%s%s%s%s",i,j,k,l,m,o);
- }
- }
- }
- }
- }
- }
- }
- if (counter < num) {
- System.out.println("No password on this position");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement