Solved problem 3

C# solution for problem 3