Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Clight_30_LoopPrintText
- {
- class Program
- {
- static void Main(string[] args)
- {
- string userText;
- string userNumber;
- bool isNumber = false;
- bool isOpen = true;
- while (isOpen == true)
- {
- Console.Clear();
- Console.Write("Привет, напиши своё сообщение: ");
- userText = Console.ReadLine();
- Console.WriteLine();
- Console.Write("Сколько раз повторить: ");
- userNumber = Console.ReadLine();
- Console.WriteLine();
- isNumber = Int32.TryParse(userNumber, out int value);
- if (isNumber == true && value >= 0)
- {
- for (int i = 0; i < value; i++)
- {
- Console.WriteLine(userText);
- }
- Console.WriteLine();
- Console.Write("Повторить? Да - \"Y\": ");
- ConsoleKeyInfo key = Console.ReadKey();
- switch (key.Key)
- {
- case ConsoleKey.Y:
- break;
- default:
- isOpen = false;
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement