forked from Alexey/DAS_2024_1
16 lines
623 B
C#
16 lines
623 B
C#
// Ищет набольшее число из файла /var/data/data.txt и сохраняет
|
||
// его вторую степень в /var/result/result.txt.
|
||
Console.WriteLine("Start second service");
|
||
var data = File.ReadAllText("/var/data/data.txt").Split(" ").ToList();
|
||
|
||
var max = data.Select(x => Int32.TryParse(x, out int value) ? value : 0).Max();
|
||
|
||
Console.WriteLine("Find max value: "+max);
|
||
if(!Directory.Exists("/var/result/"))
|
||
{
|
||
Directory.CreateDirectory("/var/result/");
|
||
}
|
||
|
||
File.WriteAllText("/var/result/result.txt", Math.Pow(max, 2).ToString());
|
||
|
||
Console.WriteLine("Save to /var/result/result.txt"); |