using System.Text; int min = int.MaxValue; int[] numbers = File.ReadAllLines("/var/data/data.txt").Select(x=> int.Parse(x)).ToArray(); foreach(var number in numbers) { if (number < min) { min = number; } } string result = Convert.ToString(Math.Pow(min, 3)); using (FileStream fstream1 = new FileStream("/var/result/result.txt", FileMode.OpenOrCreate)) { fstream1.SetLength(0); byte[] buffer1 = Encoding.Default.GetBytes(result); await fstream1.WriteAsync(buffer1, 0, buffer1.Length); } Console.WriteLine(result);