using System;
using System.Text;
namespace laba_n2
{
internal class Program
{
static void DoBlock_1()
{
Console.WriteLine("Блок 1, Задача 6");
Console.WriteLine("Введіть n:");
int n = int.Parse(Console.ReadLine());
Console.WriteLine("Введіть 1-й елемент: ");
int min = int.Parse(Console.ReadLine());
for(int i = 2; i <= n; i++)
{
Console.WriteLine("Введіть {0}-й елемент: ", i);
int current = int.Parse(Console.ReadLine());
if (current < min)
{
min = current;
}
}
Console.WriteLine("Мінімальний елемент: {0}", min);
}
static void DoBlock_2()
{
Console.WriteLine("Блок 2, Задача 33");
Console.WriteLine("Введіть K1: ");
int k1 = int.Parse(Console.ReadLine());
Console.WriteLine("Введіть K2: ");
int k2 = int.Parse(Console.ReadLine());
int count = 0;
Console.WriteLine("Вводьте числа (0 для завершення):");
int number = int.Parse(Console.ReadLine());
while (number != 0)
{
if (number % k1 == 0 && number % k2 != 0)
{
count++;
}
number = int.Parse(Console.ReadLine());
}
Console.WriteLine($"Кількість елементів: {count}");
}
static void DoBlock_3()
{
Console.WriteLine("Блок 3, Задача 53");
Console.WriteLine("Введіть a: ");
double a = double.Parse(Console.ReadLine());
Console.WriteLine("Введіть n: ");
int n = int.Parse(Console.ReadLine());
double p = 1.0;
int i = 0;
do
{
p *= (a + i);
i++;
} while (i < n);
Console.WriteLine("Результат P = {0}", p);
}
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
DoBlock_1();
DoBlock_2();
DoBlock_3();
}
}
}