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 repetitionAmounts, counter;
- string message;
- Console.Write("Введите сообщение для повторения - ");
- message = Console.ReadLine();
- input:
- Console.Write("Введите количество повторения сообщения. Отрицательное число, станет положительным. Количество - ");
- if(!int.TryParse(Console.ReadLine(), out repetitionAmounts))
- {
- Console.WriteLine("Некорректное число. Попробуйте ещё раз.");
- goto input;
- }
- if (repetitionAmounts < 0)
- repetitionAmounts *= -1;
- counter = 0;
- while (counter != repetitionAmounts)
- {
- Console.WriteLine($"Повторение №{counter+1} : "+message);
- counter++;
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement