ralichka

More.Exercises.Nested.Loops-07.Safe.passwords.generator

Jul 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07.SafePasswordsGenerator
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int a = int.Parse(Console.ReadLine());
  10.             int b = int.Parse(Console.ReadLine());
  11.             int passwordsCount = int.Parse(Console.ReadLine());
  12.  
  13.             int A = 35;
  14.             int B = 64;
  15.  
  16.             int combinations = 0;
  17.  
  18.  
  19.             for (int x = 1; x <= a; x++)
  20.             {
  21.                 for (int y = 1; y <= b; y++)
  22.                 {
  23.  
  24.                     Console.Write($"{(char)A}{(char)B}{x}{y}{(char)B}{(char)A}|");
  25.                     combinations++;
  26.                     A++;
  27.                     B++;
  28.  
  29.                     if (A > 55)
  30.                     {
  31.                         A = 35;
  32.                     }
  33.                     if (B > 96)
  34.                     {
  35.                         B = 64;
  36.                     }
  37.                     if (combinations >= passwordsCount)
  38.                     {
  39.                         return;
  40.                     }
  41.  
  42.                 }
  43.             }
  44.         }
  45.     }
  46. }
Add Comment
Please, Sign In to add comment