Загрузка данных


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp44
{
    internal class Program
    { // 10
        static int Gcd(int a, int b)
        {
            while (b != 0)
            {
                int temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }

        static int Gcd(int a, int b, int c)
        {
            return Gcd(Gcd(a, b), c);
        }

        static void Main(string[] args)
        {
            Console.Write("Введите первое число: ");
            int a = int.Parse(Console.ReadLine());

            Console.Write("Введите второе число: ");
            int b = int.Parse(Console.ReadLine());

            Console.Write("Введите третье число: ");
            int c = int.Parse(Console.ReadLine());

            Console.WriteLine("НОД двух чисел: " + Gcd(a, b));
            Console.WriteLine("НОД трёх чисел: " + Gcd(a, b, c));
        }
    }
}












using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp44
{
    internal class Program
    { // 11
        static void PrintResults(int[] scored, int[] missed)
        {
            for (int i = 0; i < scored.Length; i++)
            {
                if (scored[i] > missed[i])
                {
                    Console.WriteLine("Игра " + (i + 1) + ": выигрыш");
                }
                else if (scored[i] == missed[i])
                {
                    Console.WriteLine("Игра " + (i + 1) + ": ничья");
                }
                else
                {
                    Console.WriteLine("Игра " + (i + 1) + ": проигрыш");
                }
            }
        }

        static int CountWins(int[] scored, int[] missed)
        {
            int wins = 0;
            for (int i = 0; i < scored.Length; i++)
            {
                if (scored[i] > missed[i])
                {
                    wins++;
                }
            }
            return wins;
        }

        static int CountLosses(int[] scored, int[] missed)
        {
            int losses = 0;
            for (int i = 0; i < scored.Length; i++)
            {
                if (scored[i] < missed[i])
                {
                    losses++;
                }
            }
            return losses;
        }

        static int CountDraws(int[] scored, int[] missed)
        {
            int draws = 0;
            for (int i = 0; i < scored.Length; i++)
            {
                if (scored[i] == missed[i])
                {
                    draws++;
                }
            }
            return draws;
        }

        static int CountBigDiff(int[] scored, int[] missed)
        {
            int count = 0;
            for (int i = 0; i < scored.Length; i++)
            {
                int diff = scored[i] - missed[i];
                if (diff < 0)
                {
                    diff = -diff;
                }
                if (diff >= 3)
                {
                    count++;
                }
            }
            return count;
        }

        static int CountPoints(int[] scored, int[] missed)
        {
            int points = 0;
            for (int i = 0; i < scored.Length; i++)
            {
                if (scored[i] > missed[i])
                {
                    points += 3;
                }
                else if (scored[i] == missed[i])
                {
                    points += 1;
                }
            }
            return points;
        }

        static void Main(string[] args)
        {
            int[] scored = new int[20];
            int[] missed = new int[20];
            Random rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                scored[i] = rnd.Next(0, 10);
                missed[i] = rnd.Next(0, 10);
            }

            Console.WriteLine("=== Результаты игр ===");
            PrintResults(scored, missed);

            int wins = CountWins(scored, missed);
            int losses = CountLosses(scored, missed);
            int draws = CountDraws(scored, missed);

            Console.WriteLine("\nВыигрышей: " + wins);
            Console.WriteLine("Ничьих: " + draws);
            Console.WriteLine("Проигрышей: " + losses);
            Console.WriteLine("Игр с разностью >= 3: " + CountBigDiff(scored, missed));
            Console.WriteLine("Очков набрано: " + CountPoints(scored, missed));
        }
    }
}







using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp44
{
    internal class Program
    {// 12
        static double GetAcceleration(double f0, double angle, double mu, double m)
        {
            double angleRad = angle * Math.PI / 180;
            double fCos = f0 * Math.Cos(angleRad);
            double friction = mu * m * 9.8 * Math.Sin(angleRad);
            double f = fCos - friction;

            if (f <= 0)
            {
                return 0;
            }

            return f / m;
        }

        static void Main(string[] args)
        {
            Console.Write("Введите угол (градусы): ");
            double angle = double.Parse(Console.ReadLine());

            Console.Write("Введите коэффициент трения: ");
            double mu = double.Parse(Console.ReadLine());

            Console.Write("Введите массу тела: ");
            double m = double.Parse(Console.ReadLine());

            Console.Write("Введите силу F0: ");
            double f0 = double.Parse(Console.ReadLine());

            double a = GetAcceleration(f0, angle, mu, m);

            if (a == 0)
            {
                Console.WriteLine("Тело неподвижно");
            }
            else
            {
                Console.WriteLine("Ускорение: " + a + " м/с²");
            }
        }
    }
}












using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp44
{
    internal class Program
    { // 13
        static int FindMin(int[,] matrix, int row)
        {
            int min = matrix[row, 0];
            for (int j = 1; j < 4; j++)
            {
                if (matrix[row, j] < min)
                {
                    min = matrix[row, j];
                }
            }
            return min;
        }

        static void Main(string[] args)
        {
            int[,] matrix = new int[3, 4];
            Random rnd = new Random();

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    matrix[i, j] = rnd.Next(1, 100);
                }
            }

            Console.WriteLine("Исходная матрица:");
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Console.Write(matrix[i, j] + "\t");
                }
                Console.WriteLine();
            }

            Console.WriteLine("\nМинимальные элементы по строкам:");
            for (int i = 0; i < 3; i++)
            {
                int min = FindMin(matrix, i);
                Console.WriteLine("Строка " + (i + 1) + ": " + min);
            }
        }
    }
}