distributed-computing/tasks/melnikov-ky/lab_2/worker-2/Program.cs

22 lines
634 B
C#
Raw Permalink Normal View History

2023-10-24 21:30:03 +04:00
using System;
using System.IO;
using System.Linq;
class Program
{
static void Main()
{
string inputFile = "/var/data/data.txt";
string outputFile = "/var/result/result.txt";
string[] lines = File.ReadAllLines(inputFile);
int[] numbers = lines.Select(int.Parse).ToArray();
int minNumber = numbers.Min();
int countOfMinNumbers = numbers.Count(n => n == minNumber);
File.WriteAllText(outputFile, countOfMinNumbers.ToString());
Console.WriteLine("Количество наименьших чисел сохранено в файле: " + outputFile);
}
}