using System; public class HelloWorld { public static void Main(string[] args) { Random rand = new Random(); int pSkaits; do { Console.Write("Ievadiet parolu skaitu, kas lielaks par 4: "); } while (!int.TryParse(Console.ReadLine(), out pSkaits) || pSkaits < 5); int garakaParole; do { Console.Write("Ievadiet garako paroles simbola skaitu, kas lielaks par 9: "); } while (!int.TryParse(Console.ReadLine(), out garakaParole) || garakaParole < 9); string[] parole = new string[pSkaits]; string mazieB = "abcdefghijklmnopqrstuvwxyz"; string lielieB = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string simboli = "0123456789!@#$%^&*()_-+=<>?"; string input; bool addlielieB; do { Console.Write("Vajag lielos burtus simboliem (y/n): "); input = Console.ReadLine()?.Trim().ToLower(); } while (input != "y" && input != "n"); addlielieB = input == "y"; bool addsimboli; do { Console.Write("Vajag ciparus un simbolus simboliem (y/n): "); input = Console.ReadLine()?.Trim().ToLower(); } while (input != "y" && input != "n"); addsimboli = input == "y"; string chars = mazieB; if (addlielieB) { chars += lielieB; } if (addsimboli) { chars += simboli; } for (int i = 0; i < pSkaits; i++) { int garums = rand.Next(3, garakaParole + 1); char[] paroles = new char[garums]; string navSimboli = mazieB + (addlielieB ? lielieB : ""); if (garums > 1) { paroles[0] = navSimboli[rand.Next(navSimboli.Length)]; paroles[1] = navSimboli[rand.Next(navSimboli.Length)]; } else { paroles[0] = chars[rand.Next(chars.Length)]; } for (int j = 2; j < garums; j++) { paroles[j] = chars[rand.Next(chars.Length)]; } parole[i] = new string(paroles); } for (int i = 0; i < parole.Length; i++) { Console.WriteLine($"{i + 1}. parole: {parole[i]}"); } } }