added exercise 3 from parprog