Added C code solution