Added solution to problem 7 in C, Haskell, Java and Python