distributed-computing/tasks/zakirova-ar/lab_2/worker-2/Program.cs
2023-12-03 13:45:38 +04:00

35 lines
900 B
C#

using System.ComponentModel.DataAnnotations;
using System;
using System.IO;
string inputFile = "/var/data/data.txt";
string resultFilePath = "/var/result/result.txt";
using (StreamWriter writer = new StreamWriter(resultFilePath, false))
{
int min = int.MaxValue;
using (StreamReader sr = new StreamReader(inputFile))
{
string line;
int i = 0;
while ((line = sr.ReadLine()) != null)
{
i++;
if (int.TryParse(line, out int value))
{
if (value < min)
{
min = value;
}
}
}
Console.WriteLine("Наименьшее число: " + min.ToString());
}
double triplemin = Math.Pow(min, 3);
writer.WriteLine(triplemin.ToString());
Console.WriteLine("Файл успешно создан: " + resultFilePath);
}