This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Объявляем переменную со списком слов | |
const words = 'волны,мама,дорога,стол,мяч,книга,автомобиль,вода,школа,море,листья,солнце,ручка,огонь,дерево,солнце,цветок,школа,лес,книга'; | |
// Объявляем переменную для очищенного списка | |
let cleanWords; | |
// Проверяем список на повторения и убираем лишнее | |
const removeDuplicates = () => | |
cleanWords = words.split(',').reduce((list, current) => | |
list.includes(current) ? list : [...list, current], [] | |
).join(','); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Объявляем динамические переменные | |
let people = 0, | |
handshakes = 0, | |
log = []; | |
// Объявляем постоянные переменные | |
const targetPeople = 10; | |
const completeHandshaking = () => { | |
const report = log.map(({ people, handshakes }) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Объявляем постоянные переменные | |
const target = 100, | |
walking = 50, | |
sleeping = 30; | |
// Объявляем динамические переменные | |
let pathPassed = 0, | |
daysElapsed = 0, | |
log = []; | |
// Учитывать дни со сном или без |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] numbers = new int[] { 1, 3, 5, 7, 11, 13, 17 }; | |
int[] squares = new int[numbers.Length]; | |
int ni = 0; | |
int si = 0; | |
for (int i = 0; i < numbers.Length; i++) { | |
squares[i] = numbers[i] * numbers[i]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool[] thimbles = new bool[3] { false, true, false }; | |
Console.WriteLine("Игра в наперстки"); | |
Console.WriteLine(); | |
Console.WriteLine("[1] [2] [3]"); | |
Console.WriteLine(); | |
Console.WriteLine("под одним из трех наперстков находится шарик. Попробуйте угадать в каком!"); | |
Console.WriteLine(); | |
Console.Write("Введите ваше число от 1 до 3: "); | |
int input = Convert.ToInt32(Console.ReadLine()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int magicNumber = 4; | |
Console.WriteLine("Угадай число"); | |
Console.WriteLine(); | |
Console.WriteLine("Загадано число от 1 до 5. Попробуйте его отгадать!"); | |
Console.WriteLine(); | |
Console.Write("Введите ваше число: "); | |
int input = Convert.ToInt32(Console.ReadLine()); | |
Console.WriteLine(); | |
if (input == magicNumber) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.Write("Введите своё имя: "); | |
string name = Console.ReadLine(); | |
Console.WriteLine(); | |
Console.Write("Введите свой возраст: "); | |
string age = Console.ReadLine(); | |
Console.WriteLine(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string stringNumber = "256"; | |
int numberFromString = Convert.ToInt32(stringNumber); | |
int square = numberFromString * numberFromString; | |
Console.WriteLine("Квадрат введенного числа равен " + square); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string s1 = "Каждый "; | |
string s2 = "охотник "; | |
string s3 = "желает "; | |
string s4 = "знать, "; | |
string s5 = "где "; | |
string s6 = "сидит "; | |
string s7 = "фазан."; | |
Console.Write(s1); | |
Console.Write(s2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine("4 плюс 6 = " + (4 + 6)); | |
Console.WriteLine("4 уменьшенное на 1 = " + (4 - 1)); | |
Console.WriteLine("3 умножить на 7 = " + (3 * 7)); | |
Console.WriteLine("16 разделить на 8 = " + (16 / 8)); | |
Console.WriteLine("11 разделить на 5 = " + (11 / 5f)); | |
Console.WriteLine("целая часть от деления 13 на 3 = " + (13 / 3)); | |
Console.WriteLine("остаток от деления 17 на 8 = " + (17 % 8)); |
NewerOlder