Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace C_sharp_Light
- {
- class Program
- {
- static void Main(string[] args)
- {
- int repetitionAmount;
- string message;
- Console.Write("Введите сообщение для повторения - ");
- message = Console.ReadLine();
- while (true)
- {
- Console.Write("Введите количество повторения сообщения. Отрицательное число, станет положительным. Количество - ");
- if (!int.TryParse(Console.ReadLine(), out repetitionAmount))
- {
- Console.WriteLine("Некорректное число. Попробуйте ещё раз.");
- continue;
- }
- break;
- }
- if (repetitionAmount < 0)
- repetitionAmount *= -1;
- for (int counter = 0; counter < repetitionAmount; counter++)
- {
- Console.WriteLine($"Повторение №{counter + 1} : " + message);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement