static void Main(string[] args) { Console.WriteLine("Пожалуйста, введите учетные данные: "); int i = 1; //кол-во попыток string login; string password; do { Console.Write("Введите логин: "); login = Console.ReadLine(); Console.Write("пароль: "); password = Console.ReadLine(); if (CheckLoginPass(login, password)) { Console.WriteLine("Успешная авторизация!"); break; } else { Console.WriteLine("Неверный логин или пароль!"); i++; } } while (i <= 3); if (i > 3) { Console.WriteLine("Превышено кол-во попыток авторизации!"); } MyLib.Pause(); }
static void Main(string[] args) { Console.WriteLine("Подсчитаем сумму всех введеных нечётных положительных чисел"); Console.WriteLine("Для выхода введите \"0\" !"); Console.WriteLine($"Сумма всех введеных нечётных положительных чисел: {SumOfOddNumbers()}"); MyLib.Pause(); }
static void Main(string[] args) { DateTime start = DateTime.Now; Console.WriteLine($"\nКол-во 'хороших' чисел в диапазоне от 1 до 1 000 000 000: {GoodNumbers(1, 1000000000):N0}"); Console.WriteLine(DateTime.Now - start); //~3,5 мин для 1 000 000 000 MyLib.Pause(); }
static void Main(string[] args) { Console.WriteLine("Подсчитаем количество цифр в числе"); Console.Write("Введите число: "); long a = Convert.ToInt64(Console.ReadLine()); Console.Write($"Количетсво цифр в числе {a}: {CountOfNumbersInNumber(a)}"); MyLib.Pause(); }
static void Main(string[] args) { Console.WriteLine("Выведем числа от a до b (a < b) и посчитаем их сумму"); Console.Write("Введите a: "); int a = Convert.ToInt32(Console.ReadLine()); Console.Write("Введите b: "); int b = Convert.ToInt32(Console.ReadLine()); PrintA2B(a, b); int sum = SumA2B(a, b); Console.WriteLine($"\n{sum}"); MyLib.Pause(); }
static void Main(string[] args) { Console.WriteLine("Рассчитаем ваш индекс массы тела!"); Console.Write("Введите рост(см): "); double height = Convert.ToDouble(Console.ReadLine()) / 100; Console.Write("Введите вес(кг): "); double weight = Convert.ToDouble(Console.ReadLine()); CheckWeight(height, weight); MyLib.Pause(); }