Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Basic_Task9
- {
- class Program
- {
- static void Main(string[] args)
- {
- string password = "123456";
- string str = "";
- int attempts = 0;
- while (str != "123456" && attempts != 3)
- {
- Console.WriteLine("Введите пароль: ");
- str = Console.ReadLine();
- if (str == password)
- {
- Console.WriteLine("Ответ: 42");
- }
- else
- {
- Console.Write("Пароль неверный. ");
- attempts++;
- if (attempts != 3)
- {
- Console.WriteLine("Попробуйте еще раз.");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement