Problem 10 in c & rb