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 / Variables
Last active May 16, 2023 15:32
Declaring 10 variables of different types.
using System;
namespace MyApp
{
internal class Program
{
static void Main(string[] args)
{
ushort mana = 100;
int enemies = 5;
@Strelok78
Strelok78 / Working with strings
Last active May 16, 2023 15:39
Asking user: "what is your name", "what is your zodiac sign", etc., after which, according to the data that he led, create a small text about the user. "Your name is X, you are Y years old, you are an Z and you work at a W."
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int age;
string name;
string sign;
string workingPlace;
@Strelok78
Strelok78 / Pictures
Last active August 9, 2024 07:13
On the screen, in a special area, pictures are displayed, 3 in a row. In total, the user has 52 pictures in the album. The code outputs how many fulfilled rows it will be possible to output, and how many pictures will be beyond measure.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int amountOfPictures = 52;
int countOfRows;
int amountOfExtraPictures;
int numberOfPicturesInRow = 3;
@Strelok78
Strelok78 / Swapping values
Last active May 16, 2023 15:43
Two variables are given. Swapping the values of two variables. Displaying the values of variables before and after the permutation.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
string name = "Holmes";
string surname = "Sherlock";
string changer;
@Strelok78
Strelok78 / Crystal Shop
Last active May 16, 2023 15:44
At the start of the program, the user enters the initial amount of gold. Then he is offered to buy a certain number of crystals at the price of N. The user enter a number and his gold is converted into crystals. The rest of the gold and crystals are displayed on the screen.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int gold;
int crystals;
int crystalPrice = 5;
@Strelok78
Strelok78 / Hospital
Last active May 16, 2023 15:46
Calculates time required to stay in a queue. The user enters the number of people in the queue. The fixed reception time of one person is always 10 minutes.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int amountOfVisitors;
int visitTime = 10;
int waitingTimeHours;
int waitingTimeMinutes;
@Strelok78
Strelok78 / Mastering loops
Last active May 16, 2023 15:50
Displays the message specified by the user a specified number of times.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int repeats;
string repeatedText;
Console.WriteLine("Enter text needed to be repeated: ");
@Strelok78
Strelok78 / Output control
Last active May 16, 2023 15:53
Executing until the "exit" is entered.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
string exitText = "exit";
bool isWorking = true;
while (isWorking == true)
@Strelok78
Strelok78 / Sequence
Last active May 16, 2023 15:55
Outputs the following sequence 5 12 19 26 33 40 47 54 61 68 75 82 89 96
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int startValue = 5;
int stepValue = 7;
int valueLimit = 100;
@Strelok78
Strelok78 / Sum of numbers
Last active May 16, 2023 15:57
Using Random to get a number that is less equal than 100. Finding the sum of all positive numbers less than numbers that are multiples of 3 or 5.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int minValue = 0;
int maxValue = 100;
int divider1 = 3;
int divider2 = 5;