COP - 1000 Programming Logic challenge translated to C#