Skip to content

Instantly share code, notes, and snippets.

@QRemark
Created January 10, 2024 09:17
Show Gist options
  • Save QRemark/f22ebd6d5634541c8708ac250bff39f9 to your computer and use it in GitHub Desktop.
Save QRemark/f22ebd6d5634541c8708ac250bff39f9 to your computer and use it in GitHub Desktop.
Освоение циклов
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace homeWork2
{
internal class Program
{
static void Main(string[] args)
{
string userInput;
int userNumber;
int repeat;
Console.WriteLine( "Добрый день! Введите внизу фразу, которую хотите повторить: ");
userInput = Console.ReadLine();
Console.Write("Хорошо, спасибо. Теперь введите пожалуйста количество повторений, " +
"число запишите цифрой или цифрами: ");
userNumber = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < userNumber; i++)
{
Console.WriteLine(userInput);
repeat = userNumber - i - 1;
Console.WriteLine($"Оставшееся количество повторений: {repeat}.");
}
Console.WriteLine("Повторения окончены.");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment