Solved problem 9

C# console solution for problem 9