Add #45 solutions in C and Ruby