My solutions for Advent of Code.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
adventofcode/2019/Day1/Part1/Program.cs

25 lines
601 B

5 years ago
using System;
using System.IO;
namespace _1
{
class Program {
static void Main(string[] args) {
string input = File.ReadAllText(@"./input.txt");
string[] inputs = input.Split( Environment.NewLine, StringSplitOptions.None );
int[] output = new int[100];
double input_;
5 years ago
int sum = 0;
for ( int i = 0; i < inputs.Length; i++ ) {
Console.WriteLine( inputs[i] );
input_ = Convert.ToDouble(inputs[i]);
output[i] = (int)Math.Floor( input_/3 ) - 2;
Console.WriteLine(output[i]);
5 years ago
sum += output[i];
}
5 years ago
Console.WriteLine("Sum: " + sum.ToString() );
5 years ago
}
}
}