Skip to content

Instantly share code, notes, and snippets.

View Strelok78's full-sized avatar

Shota Strelok78

  • Saint-Petersburg, Russia
View GitHub Profile
@Strelok78
Strelok78 / Currency converter
Last active May 16, 2023 15:59
The user has a balance in each of the presented currencies. He may ask to convert part of the balance from one currency to another. (3 currencies in total)
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
const string CommandExit = "0";
const string CommandUSDtoRUB = "1";
const string CommandUSDtoEUR = "2";
const string CommandRUBtoUSD = "3";
@Strelok78
Strelok78 / Console menu
Last active May 16, 2023 16:02
Simple fighting console menu
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
const string CommandExit = "0";
const string CommandHeroHP = "1";
const string CommandHeroDamage = "2";
const string CommandEnemyHP = "3";
@Strelok78
Strelok78 / Output name in square of symbols
Last active May 16, 2023 16:03
Prints the name in a rectangle from the character that the user enters himself.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
string name;
string nameLine;
string symbolLine = "";
char symbol;
@Strelok78
Strelok78 / Password checker
Last active May 16, 2023 16:06
The user enters the password, then user has 3 chances to enter correct password. If the password fits, it outputs a secret message, else program ends.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
string enter;
string password = "iJunior";
int tries = 3;
@Strelok78
Strelok78 / Multiples
Last active May 16, 2023 16:08
N (1 ≤ N ≤ 27). Finds the number of three-digit natural numbers that are multiples of N. Division operations (/, %) are not used. And multiplication is not required. The number N is only one.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int minRandom = 1;
int maxRandom = 100;
int randomNumber = new Random().Next(minRandom, maxRandom+1);
int minValue = 100;
@Strelok78
Strelok78 / The determinant of the power of two
Last active May 16, 2023 16:09
Finds the minimum power of two that exceeds the specified number.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
Random random = new Random();
int maxNumber = 100;
int numberToPower = 2;
@Strelok78
Strelok78 / Valid bracket expression
Last active May 16, 2023 16:42
A string of the characters '(' and ')' is given. It is determined whether it is a valid parenthesis expression. The maximum depth of nesting of brackets is determined.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
const char OpenBrace = '(';
const char CloseBrace = ')';
int countBracesLevel = 0;
@Strelok78
Strelok78 / Boss fight
Last active May 16, 2023 16:44
Here is a boss who has a certain number of lives and a certain retaliatory damage. You have 4 spells to deal damage to the boss. The program ends only after the death of the boss or the death of the user.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
const string CommandDefenseAura = "1";
const string CommandLayOnHands = "2";
const string CommandMagicPower = "3";
const string CommandUseWarhammer = "4";
@Strelok78
Strelok78 / Working with correct rows and columns
Last active May 16, 2023 16:45
There is a two-dimensional array. The sum of the second row and the product of the first column are calculated. The initial matrix and calculation results are displayed.
internal class Program
{
static void Main(string[] args)
{
int[,] arrayNumbers =
{
{1, 2, 3},
{4, 5, 6},
};
int sum = 0;
@Strelok78
Strelok78 / Greatest element
Last active May 16, 2023 16:47
Finds the greatest element of the matrix A(10,10) and writes zero to the cells where it is located. Outputs the greatest element, the original and the resulting matrix.
{
internal class Program
{
static void Main(string[] args)
{
int[,] a = new int[10, 10];
int maxInTable = int.MinValue;
int minValue = 1;
int maxValue = 100;