distributed-computing/tasks/mironov-eo/lab_2/worker-2/Program.cs

21 lines
468 B
C#
Raw Normal View History

2023-10-31 00:41:47 +04:00
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());