Advertisement
Vlad_Savitskiy

Simple cycle 2

Jun 30th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CSLightFirst
  4. {
  5.     class Program
  6.     {
  7.         private static void Main()
  8.         {
  9.             string message;
  10.             int count;
  11.  
  12.             while (true)
  13.             {
  14.                 Console.Write("Введите сообщение, которое хотите повторить: ");
  15.                 message = Console.ReadLine();
  16.  
  17.                 Console.Write("Сколько раз вы хотите его повторить? ");
  18.  
  19.                 if (int.TryParse(Console.ReadLine(), out count))
  20.                 {
  21.                     Console.WriteLine();
  22.                     for (int i = 0; i < count; i++)
  23.                         Console.WriteLine(message);
  24.                     Console.WriteLine();
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.Clear();
  29.                     Console.WriteLine("Введено некорректное число! Попробуйте ещё раз...\n");
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement