Exemple #1
0
        public int Execute()
        {
            string line;

            var fuel = 0;

            var file = new StreamReader(@"inputs\inputDay01.txt");

            while ((line = file.ReadLine()) != null)
            {
                if (int.TryParse(line.Trim(), out var weight))
                {
                    fuel = fuel + FuelCalculator.GetFuel(weight);
                }
            }

            return(fuel);
        }