Groney

SafePassword

Dec 21st, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. package SelfTestExams.DecemberExam2018;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class PasswordGenerator {
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.  
  9.         int a = Integer.parseInt(scan.nextLine());
  10.         int b = Integer.parseInt(scan.nextLine());
  11.         int total = Integer.parseInt(scan.nextLine());
  12.  
  13.         char aA = 35;
  14.         char bB = 64;
  15.         int count = 1;
  16.  
  17.         for (int i = 1; i <= a; i++) {
  18.             for (int j = 1; j <= b; j++) {
  19.                 if (count > total) {
  20.                     return;
  21.                 }
  22.                 System.out.printf("%c%c%d%d%c%c|", aA, bB, i, j, bB, aA);
  23.  
  24.                 aA++;
  25.                 bB++;
  26.                 count++;
  27.  
  28.                 if (aA > 55) {
  29.                     aA = 35;
  30.                 }
  31.                 if (bB > 96) {
  32.                     bB = 64;
  33.                 }
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment