Renamed summative variable in problem1 because sum is already defined
Adding solution for problem 3