Added solution in C.