Problem 3 written on Javascript has been added.