addded new problem 1 function code