distributed-computing/tasks/lyamzina-ma/lab_2/worker-2/Program.cs

23 lines
635 B
C#
Raw Normal View History

2023-10-24 21:30:27 +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);
}
}