Advertisement
Deiancom

SafePasswordGenerator

Oct 24th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. package ProgrammingBasics.NestedLoops;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SafePasswordsGenerator07 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int thirdSymbol = Integer.parseInt(scanner.nextLine());
  10.         int fourthSymbol = Integer.parseInt(scanner.nextLine());
  11.         int max = Integer.parseInt(scanner.nextLine());
  12.         int a = 35;
  13.         int b = 64;
  14.         int counter = 0;
  15.  
  16.         for (int i = 1; i <= thirdSymbol; i++) {
  17.             for (int j = 1; j <= fourthSymbol; j++) {
  18.                 System.out.printf("%c%c%d%d%c%c|", a, b, i, j, b, a);
  19.                 counter++;
  20.                 if (i == thirdSymbol && j == fourthSymbol || counter == max) {
  21.                     return;
  22.                 }
  23.                 a++;
  24.                 b++;
  25.                 if (a > 55) {
  26.                     a = 35;
  27.                 }
  28.                 if (b > 96) {
  29.                     b = 64;
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement