Skip to content

Instantly share code, notes, and snippets.

@IvanEnginer
Created August 24, 2024 12:29
Show Gist options
  • Select an option

  • Save IvanEnginer/2dc3bb732f9a3d4fb957acc1d030e11b to your computer and use it in GitHub Desktop.

Select an option

Save IvanEnginer/2dc3bb732f9a3d4fb957acc1d030e11b to your computer and use it in GitHub Desktop.
using System;
namespace HW_02
{
internal class Program
{
static void Main(string[] args)
{
const string commandExit = "q";
bool isWork = true;
bool isGuess;
double probable = 0.5d;
string choiceOfSide;
string command;
Random random = new Random();
double chance;
while (isWork)
{
Console.WriteLine("Введите Орел или Решка");
choiceOfSide = Console.ReadLine().ToLower();
chance = random.NextDouble();
if (chance <= probable)
isGuess = true;
else
isGuess = false;
if (isGuess)
Console.WriteLine("Поздравляю ты угадал");
else
Console.WriteLine("Ты не угадал");
Console.WriteLine("Что бы закончить игру введи q");
command = Console.ReadLine();
if (command == commandExit)
isWork = false;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment