Solved problem 7

C# solution for problem 7