solved problem 47 with C#