Solved problem 8

C# console solution for problem 8