Added c solution.

Added the c solution that I posted on reddit.