Skip to content

Instantly share code, notes, and snippets.

@LevShab
Last active September 30, 2026 15:57
Show Gist options
  • Select an option

  • Save LevShab/574bdabe7353073127ee to your computer and use it in GitHub Desktop.

Select an option

Save LevShab/574bdabe7353073127ee to your computer and use it in GitHub Desktop.
Game
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Game
{
class Program
{
static void Main(string[] args)
{
int round = 0;
int score = 0;
int random;
Console.WriteLine("Я хочу сыграть с тобой в одну игру, отгодай число от 0 до 100");
while(round != 10){
Random random_nenuzon = new Random(DateTime.Now.Millisecond);
random = random_nenuzon.Next(101); // Если хотим от 1 до 100 пишем в скобках - 1, 101
Console.WriteLine("Введи число");
int answer = Convert.ToInt32(Console.ReadLine());
if (answer == random) {
Console.WriteLine("Вы выйграли");
score++; //Это тоже самое что и score = score + 1
}else{
Console.WriteLine("Вы не выйграли");
}
round++;
Console.Write("Ваш счет на данный момент равен ");
Console.WriteLine(score);
Console.Write("Вы сыграли ");
Console.Write(round);
Console.WriteLine(" раундов из 10");
}
Console.Write("Вы сыграли со счетом ");
Console.Write(score);
Console.WriteLine(" баллов из 10");
}
}
}
@ThorneAlaric288

Copy link
Copy Markdown

Thanks for the information.

reading apps for adults

@sarenleroi-ux

Copy link
Copy Markdown

This is a nice little C# console game for beginners. It keeps the logic simple while showing some useful basics: loops, conditions, random numbers, user input, counters, and score tracking. I also like that the game gives feedback after every round, so it is easy to follow what is happening. It is interesting how even a small programming exercise can lead into broader topics around technology and building projects. I came across this article businessnow.mt/uri-poliavich-philanthroy-education-and-the-yael-foundation/ while looking at that wider connection, and it discusses philanthropy, education, and the Yael Foundation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment