Предмет:
ИнформатикаАвтор:
lorenapk7tОтвет:
using System;
namespace ConsoleApp4
{
class Program
{
static void Main()
{
int attempts = 1;
Random r = new Random();
int x = r.Next(11);
Console.WriteLine("Ok. I made a guess. Now you have 3 attempts.");
for (int i=0; i < 3; ++i)
{
Console.WriteLine($"Attepmt #{attempts}");
if (int.Parse(Console.ReadLine()) == x)
{
Console.WriteLine($"Congrutialations! You got it!It really was number: {x}Attempts passed: {attempts}Try again? y/n");
if (Console.ReadLine() == "y")
{
Console.Clear();
Main();
return;
}
return;
}
Console.WriteLine("Nope.");
attempts++;
}
Console.WriteLine($"You lose.It was: {x}Try again? y/n", x);
if (Console.ReadLine() == "y")
{
Console.Clear();
Main();
return;
}
}
}
}
Автор:
chanaДобавить свой ответ
Предмет:
АлгебраАвтор:
rodrigodennisОтветов:
Смотреть
Предмет:
ФизикаАвтор:
kiaraaustinОтветов:
Смотреть
Предмет:
МатематикаАвтор:
blondieramosОтветов:
Смотреть