distributed-computing/tasks/mironov-eo/lab_2/worker-2/Program.cs
2023-10-30 23:41:47 +03:00

21 lines
468 B
C#

var collection = File.ReadLines("/var/data/data.txt");
if (!collection.Any())
{
throw new ArgumentException("Incorrect file");
}
if (!int.TryParse(collection.First(), out int firstNumber))
{
throw new ArgumentException("Wrong number");
}
if (!int.TryParse(collection.Last(), out int lastNumber))
{
throw new ArgumentException("Wrong number");
}
var result = lastNumber * firstNumber;
File.WriteAllText("/var/result/result.txt", result.ToString());