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
| /* | |
| Задача 64: Задайте значения N. Напишите программу, которая выведет все натуральные числа в промежутке от N до 1. | |
| N = 5. -> "5, 4, 3, 2, 1" | |
| N = 8. -> "8, 7, 6, 5, 4, 3, 2, 1" | |
| */ | |
| Console.Write("Введите число: "); | |
| int number = Convert.ToInt32(Console.ReadLine()); | |
| int count = 1; | |
| NaturalToLow(number, count); |
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
| /* | |
| Задача 54: Задайте двумерный массив. Напишите программу, которая упорядочит по убыванию элементы каждой строки двумерного массива. | |
| Например, задан массив: | |
| 1 4 7 2 | |
| 5 9 2 3 | |
| 8 4 2 4 | |
| В итоге получается вот такой массив: | |
| 7 4 2 1 | |
| 9 5 3 2 | |
| 8 4 4 2 |
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
| /* | |
| Задача 47. | |
| Задайте двумерный массив размером m×n, заполненный случайными вещественными числами. | |
| m = 3, n = 4. | |
| 0,5 7 -2 -0,2 | |
| 1 -3,3 8 -9,9 | |
| 8 7,8 -7,1 9 | |
| */ | |
| int rows = ReadInt("Введите количество строк: "); |
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
| /* | |
| Задача 41:Пользователь вводит с клавиатуры M чисел. Посчитайте, сколько чисел больше 0 ввёл пользователь. | |
| 0, 7, 8, -2, -2 -> 2 | |
| 1, -7, 567, 89, 223 -> 4 | |
| */ | |
| Console.WriteLine("Введите числа через запятую: "); | |
| string? input = Console.ReadLine(); | |
| int[] numbers = ParseStringToArray(input); | |
| PrintArray(numbers); |
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
| /* Задача 34: Задайте массив заполненный случайными положительными трёхзначными числами. Напишите программу, | |
| которая покажет количество чётных чисел в массиве. | |
| [345, 897, 568, 234] -> 2 | |
| */ | |
| Console.WriteLine("Введите размер массива"); | |
| int size = Convert.ToInt32(Console.ReadLine()); | |
| int[] numbers = new int[size]; | |
| int count = 0; |
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
| /* | |
| Задача 25: (branch task_1) | |
| Напишите цикл, который принимает на вход два числа (A и B) и возводит число A в натуральную степень B. | |
| 3, 5 -> 243 (3⁵) | |
| 2, 4 -> 16 | |
| */ | |
| int numberA = ReadInt("Введите число A: "); | |
| int numberB = ReadInt("Введите число B: "); | |
| ToDegree(numberA, numberB); |
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
| /* | |
| Задача 19 | |
| Напишите программу, которая принимает на вход пятизначное число и проверяет, является ли оно палиндромом. | |
| 14212 -> нет | |
| 12821 -> да | |
| 23432 -> да | |
| */ | |
| Console.WriteLine("Введите число: "); | |
| string number = 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
| /* | |
| Задача 10: Напишите программу, которая принимает на вход трёхзначное число и на выходе показывает вторую цифру этого числа. | |
| 456 -> 5 | |
| 782 -> 8 | |
| 918 -> 1 | |
| */ | |
| int number = ReadInt("Введите трехзначное число: "); | |
| int amount = number.ToString().Length; |
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
| /* | |
| Задача 15: | |
| Напишите программу, которая принимает на вход цифру, обозначающую день недели, и проверяет, является ли этот день выходным. | |
| 6 -> да | |
| 7 -> да | |
| 1 -> нет | |
| */ | |
| int dayNumber = ReadInt("Введите число от 1 до 7: "); | |
| Console.WriteLine(WorkHoliday(dayNumber)); |
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
| /* | |
| Задача 13: Напишите программу, которая выводит третью цифру заданного числа или сообщает, что третьей цифры нет. | |
| 645 -> 5 | |
| // 78 -> третьей цифры нет | |
| // 32679 -> 6 | |
| */ | |
| int number = ReadInt("Введите число: "); | |
| int count = number.ToString().Length; | |
| Console.Write(MakeArray(number, count)); |
NewerOlder