damesova

Safe Passwords Generator - Java

Dec 16th, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. package Exan1to2Dec18;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SafePasswordsGenerator {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int a = Integer.parseInt(scanner.nextLine());
  10. int b = Integer.parseInt(scanner.nextLine());
  11. int nMax = Integer.parseInt(scanner.nextLine());
  12.  
  13. int count = 0;
  14. int i = 35;
  15. int j = 64;
  16.  
  17. for (int k = 1; k <= a; k++) {
  18. for (int l = 1; l <= b; l++) {
  19. char first = (char)(i);
  20. char second = (char) j;
  21. char fifth = (char) j;
  22. char sixth = (char) i;
  23. System.out.printf("%c%c%d%d%c%c|",first, second, k, l, fifth, sixth);
  24.  
  25. count++;
  26.  
  27. if ((k == a && l == b) || count == nMax) {
  28. return;
  29. }
  30.  
  31. i++;
  32. j++;
  33.  
  34. if (i > 55) {
  35. i = 35;
  36. }
  37.  
  38. if (j > 96) {
  39. j = 64;
  40. }
  41. }
  42. }
  43. }
  44. }
Add Comment
Please, Sign In to add comment