Solutions for #1, 3, 5, 9 in C#